Open gaulthiergain opened 2 years ago
This is my script written in fish that does the calculation
function uksm_profit
if not test -d /sys/kernel/mm/uksm
echo "UKSM not installed"
return
end
set pages (cat /sys/kernel/mm/uksm/pages_sharing)
set zero_pages (cat /proc/meminfo | grep KsmZero | awk '{print $2}')
set total_in_MB (echo "scale=2; $pages*4/1024 + $zero_pages/1024" | bc)
printf "Saved %s MB\n" $total_in_MB
end
You also need to take into account zero pages, which are handled by UKSM separately.
In order to compute the total number of frames, I did the following computation with KSM vanilla:
#used_frames = pages_volatile+pages_unshared+pages_shared
Is this calculation still valid with uksm? (not considering volatile pages):
#used_frames = pages_unshared+pages_shared