Skip to content

Instantly share code, notes, and snippets.

@xarses
Created November 10, 2014 17:57
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/049fcef7236c1058f3c0 to your computer and use it in GitHub Desktop.
Save xarses/049fcef7236c1058f3c0 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ $(head /sys/kernel/mm/ksm/run) = "0" ]] ; then
echo "ksm is not enabled. /sys/kernel/mm/ksm/run must be 1"
return 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