There are 3 knobs in redhat_transparent_hugepage/ in the order of effectiveness
- enabled – this is the main knob. Setting as disable will disable THP entirely.
- defrag – THP is on. If disabled, no defrag by application thread. See note (1) below.
- khugepaged/defrag – THP is on. If disabled, no defrag by kernel thread khugepaged. See note (2) below
Note that defrag can happen in 2 scenarios:
- When application thread needs memory, it traps into kernel and tries to allocate huge page. If defrag is on, the process will try to coalescent small pages into large pages. (This is what Espresso ran into and the Hadoop blog describes)
- THP also has a khugepaged that tries to defrag in the background (so that more huge pages are avail and application thread defrags less frequently).
Thus echo “disable” to “enabled” is sufficient.