diff options
author | Oran Agra <oran@redislabs.com> | 2022-10-13 13:05:20 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2022-12-12 17:36:34 +0200 |
commit | 92ad0b5c8b3256871dc9e5da2249e44c76b59c92 (patch) | |
tree | 3fd724dac7f0638d0dba2f144723887b7fa5bfb2 | |
parent | 6cf24fa437b04468055b4afbb24732208e549264 (diff) | |
download | redis-92ad0b5c8b3256871dc9e5da2249e44c76b59c92.tar.gz |
Improve linux overcommit check and warning (#11357)
1. show the overcommit warning when overcommit is disabled (2),
not just when it is set to heuristic (0).
2. improve warning text to mention the issue with jemalloc causing VM
mapping fragmentation when set to 2.
(cherry picked from commit dd60c6c8d3f605bca2fb45431edadbf0a5da1492)
-rw-r--r-- | src/syscheck.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/syscheck.c b/src/syscheck.c index 5f0b799e4..41545f0c1 100644 --- a/src/syscheck.c +++ b/src/syscheck.c @@ -150,9 +150,12 @@ int checkOvercommit(sds *error_msg) { } fclose(fp); - if (strtol(buf, NULL, 10) == 0) { + if (strtol(buf, NULL, 10) != 1) { *error_msg = sdsnew( - "overcommit_memory is set to 0! Background save may fail under low memory condition. " + "Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. " +#if defined(USE_JEMALLOC) + "Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. " +#endif "To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the " "command 'sysctl vm.overcommit_memory=1' for this to take effect."); return -1; |