Created
January 19, 2020 11:15
-
-
Save farrokhi/fcc0d82789e01822e1f21397f5d5d2aa to your computer and use it in GitHub Desktop.
Enforce dropping page cache and trigger memory page compactor for Linux MM
This file contains hidden or 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/sh | |
set -u | |
NUMA_BEFORE=`numactl -H | grep free:` | |
SLAB_BEFORE=`grep Normal /proc/buddyinfo` | |
printf "Dropping page cache..." | |
sysctl -qw vm.drop_caches=1 | |
echo | |
printf "Defragmenting memory pages..." | |
sysctl -qw vm.compact_memory=1 | |
echo | |
NUMA_AFTER=`numactl -H | grep free:` | |
SLAB_AFTER=`grep Normal /proc/buddyinfo` | |
echo | |
echo "Free memory per NUMA domain:" | |
echo "Before: " ${NUMA_BEFORE} | tr -s ' ' '\t' | |
echo "After: " ${NUMA_AFTER} | tr -s ' ' '\t' | |
echo | |
echo "Slab Allocator status:" | |
echo "Before: " ${SLAB_BEFORE} | tr -s ' ' '\t' | |
echo "After: " ${SLAB_AFTER} | tr -s ' ' '\t' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment