1

reboot the linux (ubuntu 16.04 redis 4.011)

/var/log/redis.log

shows

# 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.

So I do

way1:

/etc/rc.local

if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
   echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
   echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi

when reboot the machine

the /var/log/redis.log shows the THP warning still.

But when I use

$cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
$cat /sys/kernel/mm/transparent_hugepage/defrag
always defer madvise [never]

I got the right [never]

$systemctl restart redis

the /var/log/redis.log shows no THP warning.

But it is not correct the issue as when the machine reboot is still having the THP warning.

So I try way2: remove the /etc/rc.local if...fi sentence first

$apt install sysfsutils

add these two lines to /etc/sysfs.conf:

kernel/mm/transparent_hugepage/enabled = never  
kernel/mm/transparent_hugepage/defrag = never

reboot

/var/log/redis.log got no any new message???

how can I get my log again? Is the sysfutils eat it?

$systemctl status redis

the redis is active.

$cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
$cat /sys/kernel/mm/transparent_hugepage/defrag
always defer [madvise] never

I got [madvise] ?????

then

$systemctl restart redis
$cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
$cat /sys/kernel/mm/transparent_hugepage/defrag
always defer [madvise] never

the [madvise] come again?
the[never] for the defrag is not choose right??!

it's strage when I change the enabled and defrag on /etc/sysfs.conf:

kernel/mm/transparent_hugepage/defrag = never   
kernel/mm/transparent_hugepage/enabled = never 

I got the right cat result $systemctl restart redis $cat /sys/kernel/mm/transparent_hugepage/enabled always madvise [never] $cat /sys/kernel/mm/transparent_hugepage/defrag always defer madvise [never]

But still no any message added to my /var/log/redis.log when reboot the linux.

But can add new message when I command "systemctl restart redis"

why is so strange situation? which is correct and how to fix it?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.