提交 868f40c1 编写于 作者: A antirez

Check THP support at startup and warn about it.

上级 e293cfcf
......@@ -63,6 +63,7 @@ struct latencyStats {
void latencyMonitorInit(void);
void latencyAddSample(char *event, mstime_t latency);
int THPIsEnabled(void);
/* Latency monitoring macros. */
......
......@@ -31,6 +31,7 @@
#include "cluster.h"
#include "slowlog.h"
#include "bio.h"
#include "latency.h"
#include <time.h>
#include <signal.h>
......@@ -3330,10 +3331,13 @@ int linuxOvercommitMemoryValue(void) {
return atoi(buf);
}
void linuxOvercommitMemoryWarning(void) {
void linuxMemoryWarnings(void) {
if (linuxOvercommitMemoryValue() == 0) {
redisLog(REDIS_WARNING,"WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. 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.");
}
if (THPIsEnabled()) {
redisLog(REDIS_WARNING,"WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.");
}
}
#endif /* __linux__ */
......@@ -3606,7 +3610,7 @@ int main(int argc, char **argv) {
/* Things not needed when running in Sentinel mode. */
redisLog(REDIS_WARNING,"Server started, Redis version " REDIS_VERSION);
#ifdef __linux__
linuxOvercommitMemoryWarning();
linuxMemoryWarnings();
#endif
loadDataFromDisk();
if (server.cluster_enabled) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册