Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Total number of frames #74

Open
gaulthiergain opened this issue Dec 30, 2021 · 1 comment
Open

Total number of frames #74

gaulthiergain opened this issue Dec 30, 2021 · 1 comment

Comments

@gaulthiergain
Copy link

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

@dolohow
Copy link
Owner

dolohow commented Mar 4, 2022

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants