Transparent Huge Pages (THP) Support


We have performed an update from SLES Ent 11 SP1(x64) to SLES Ent 11 SP2(x64), since this patch we are seeing an increase of the time spend for backing up database.

For instance postgres recommends the following setup for THP:

db1: ~ # echo always > /sys/kernel/mm/transparent_hugepage/enabled db1: ~ # echo madvise > /sys/kernel/mm/transparent_hugepage/defrag

In Sles11 SP2 release notes in certain type of cases you recomend to disable THP

echo never > /sys/kernel/mm/transparent_hugepage/enabled

Can we safely disable THP or it’s better to run with all services stop?

In case of recommendation is only change madvise to defrag algoritm is safe to run this commands?

What is the recomendation to use THP? Is really an advantage ? Or should be disabled specially in a database environment?

Current THP configuration:

DB1:/ # grep . -r /sys/kernel/mm/transparent_hugepage/ /sys/kernel/mm/transparent_hugepage/enabled:[always] madvise never /sys/kernel/mm/transparent_hugepage/defrag:[always] madvise never /sys/kernel/mm/transparent_hugepage/khugepaged/defrag:1 /sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_none:511 /sys/kernel/mm/transparent_hugepage/khugepaged/pages_to_scan:4096 /sys/kernel/mm/transparent_hugepage/khugepaged/pages_collapsed:2929 /sys/kernel/mm/transparent_hugepage/khugepaged/full_scans:1665 /sys/kernel/mm/transparent_hugepage/khugepaged/scan_sleep_millisecs:10000 /sys/kernel/mm/transparent_hugepage/khugepaged/alloc_sleep_millisecs:60000

Memory Information:

DB1:/ # cat /proc/`pgrep khugepaged`/io rchar: 0 wchar: 0 syscr: 0 syscw: 0 read_bytes: 0 write_bytes: 54968320 cancelled_write_bytes: 0

DB1:/ # cat /proc/meminfo | grep HugePages AnonHugePages: 661504 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0

DB1:/ # cat /proc/meminfo MemTotal: 99193492 kB MemFree: 380572 kB Buffers: 1653360 kB Cached: 91328156 kB SwapCached: 3164 kB Active: 51591364 kB Inactive: 42169564 kB Active(anon): 10819624 kB Inactive(anon): 1358628 kB Active(file): 40771740 kB Inactive(file): 40810936 kB Unevictable: 4892 kB Mlocked: 4892 kB SwapTotal: 2104508 kB SwapFree: 2090728 kB Dirty: 1908 kB Writeback: 0 kB AnonPages: 781640 kB Mapped: 11430844 kB Shmem: 11395772 kB Slab: 3774012 kB SReclaimable: 3669088 kB SUnreclaim: 104924 kB KernelStack: 7832 kB PageTables: 184756 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 51701252 kB Committed_AS: 28514972 kB VmallocTotal: 34359738367 kB VmallocUsed: 759668 kB VmallocChunk: 34308578336 kB HardwareCorrupted: 0 kB AnonHugePages: 661504 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 159744 kB DirectMap2M: 5074944 kB DirectMap1G: 95420416 kB

Thank you in advanced.
Best Regards,
Sérgio Machado

With the lack of information we decide to disable transparent hugepage and wait for a more mature state of THP.
Appending the following parameters to boot loader:
transparent_hugepage=never intel_idle.max_cstate=0 processor.max_cstate=0

Manual setting Huge Page for Database.