Created
May 28, 2015 17:25
-
-
Save xarses/0a52d55c97cb9f18e7c7 to your computer and use it in GitHub Desktop.
ksm check script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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