Skip to content

Instantly share code, notes, and snippets.

@xarses
Created May 28, 2015 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xarses/0a52d55c97cb9f18e7c7 to your computer and use it in GitHub Desktop.
Save xarses/0a52d55c97cb9f18e7c7 to your computer and use it in GitHub Desktop.
ksm check script
#!/bin/bash
if [[ $(head /sys/kernel/mm/ksm/run) = "0" ]] ; then
echo "ksm is not enabled. /sys/kernel/mm/ksm/run must be 1"
exit 1
fi
files=$(ls /sys/kernel/mm/ksm/pages*)
pagesz=$(getconf PAGESIZE)
for file in $files
do
short=$(echo $file | cut -d/ -f6)
value=$(cat $file)
echo $short pages: $value mb: $(expr $pagesz \* $value / 1024 / 1024)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment