Skip to content

Commit

Permalink
Transparent Hugepages - madvise is recommended now (#211)
Browse files Browse the repository at this point in the history
check for madvise now instead of never
remove - threshold checking
refactor - for easier maintenance, get rid of grep
  • Loading branch information
PeterPitterling authored Sep 2, 2024
1 parent 032589b commit 2f399a5
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions scripts/lib/check/2000_transparent_hugepages.check
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function check_2000_transparent_hugepages {

# MODIFICATION SECTION>>
local -r sapnote='#2131662' # Transparent Huge Pages (THP) on SAP HANA Servers
local -i _thp_threshold=50
# MODIFICATION SECTION<<

# PRECONDITIONS
Expand All @@ -21,24 +20,29 @@ function check_2000_transparent_hugepages {
else
# CHECK

if grep -q '\[never\]' /sys/kernel/mm/transparent_hugepage/enabled ; then
logCheckOk "Transparent Hugepages are disabled (SAP Note ${sapnote:-})"
_retval=0
else
logCheckError "Transparent Hugepages are not disabled (SAP Note ${sapnote:-})"
_retval=2
fi

#THP in use?
local nr_anon_thp
nr_anon_thp=$(grep 'nr_anon_transparent_hugepages' /proc/vmstat)
nr_anon_thp=$(LIB_FUNC_TRIM_LEFT "${nr_anon_thp/nr_anon_transparent_hugepages}")

if [[ ${nr_anon_thp} -ge ${_thp_threshold} ]] ; then
logCheckWarning "Transparent Hugepages are currently allocated and in use (is: ${nr_anon_thp}, should be: 0)"
#keep higher return values
[[ ${_retval} -eq 0 ]] && _retval=1
fi
logCheckInfo "Transparent Hugepages currently allocated (is: ${nr_anon_thp})"

local thp_setting
thp_setting=$(</sys/kernel/mm/transparent_hugepage/enabled)

case ${thp_setting:-} in

'[madvise]' )
logCheckOk "Transparent Hugepages are set as recommended (SAP Note ${sapnote:-}) (is: ${thp_setting})"
_retval=0 ;;
'[never]' )
logCheckWarning "Transparent Hugepages are NOT set as recommended (SAP Note ${sapnote:-}) (is: ${thp_setting})"
_retval=1 ;;
* )
logCheckError "Transparent Hugepages are NOT set as recommended (SAP Note ${sapnote:-}) (is: ${thp_setting})"
_retval=2 ;;

esac

fi

Expand Down

0 comments on commit 2f399a5

Please sign in to comment.