KSM with 2.6.35

e100

Renowned Member
Nov 6, 2010
1,268
46
88
Columbus, Ohio
ulbuilder.wordpress.com
So far 2.6.35 is working well for me, the only problem I have is understanding the parameters in ksmtuned.conf. I have looked for documentation but found none so I made my own.

/etc/ksmtuned.conf:
Code:
# Configuration file for ksmtuned.
#DEBUG=1
# number of seconds ksmtuned should sleep between tuning adjustments
# Every KSM_MONITOR_INTERVAL seconds ksmtuned adjust how aggressive KSM will
# search for duplicated pages based on free memory.
# KSM_MONITOR_INTERVAL=60

# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# How many Milliseconds to sleep between scans of 16GB of RAM.
# The actual sleep time is calculated as sleep = KSM_SLEEP_MSEC * 16 / Total GB of RAM
# The final sleep value will be written to /sys/kernel/mm/ksm/sleep_millisecs
# KSM_SLEEP_MSEC=100

# KSM_NPAGES_BOOST: amount to increment the number of pages to scan
# The number of pages to be scanned will be increased by KSM_NPAGES_BOOST
# when the amount of free ram < threshold (see KSM_THRES_* below)
# KSM_NPAGES_BOOST=300

# KSM_NPAGES_DECAY: amount to decrease the number of pages to scan
# The number of pages to be scanned will be decreased by KSM_NPAGES_DECAY
# when the amount of free ram >= threshold (see KSM_THRES_* below)
# KSM_NPAGES_DECAY=-50

# KSM_NPAGES_MIN: Minimum number of pages to be scanned at all times
# KSM_NPAGES_MIN=64

# KSM_NPAGES_MAX: Maximum number of pages to be scanned at all times
# KSM_NPAGES_MAX=1250

# KSM_THRES_COEF: Decimal percentage of free RAM
# If free memory is less than this percentage KSM will be activated
# KSM_THRES_COEF=20

# KSM_THRES_CONST: Bytes
# If free memory is less than this number KSM will be activated
# KSM_THRES_CONST=2048

#NOTE: Only KSM_THRES_CONST or KSM_THRES_COEF is actually used.
#Whichever results in a larger number wins.
 
Thanks mate, that config helped me a lot :).
It made it clear why KSM was not working.
Even though I tried to force /sys/kernel/mm/ksm/run to "1", it kept reverting back to "0".

Kudos to you my friend :)
 
:rolleyes: :) :D
Thank you very much e100
Your post should be made sticky !
Now my ksmd works, at last !
 
Thanks e100 :

According Proxmox Docu, KSM should start when less than 50% of Ram is free, but with defaults from ksmtuned:
Code:
KSM_THRES_COEF=20
KSM_THRES_CONST=2048
It never started in my configuration .... (4Gb Memory and 800 Mb free)

You Note:

Code:
#NOTE: Only KSM_THRES_CONST or KSM_THRES_COEF is actually used. 
#Whichever results in a larger number wins.
larger was the key to my problem. I reduced THRES_CONST to 1024 and it inmediately started ..
Thanks
 
Last edited:
Thanks e100 :

According Proxmox Docu, KSM should start when less than 50% of Ram is free, but with defaults from ksmtuned:
Code:
KSM_THRES_COEF=20
KSM_THRES_CONST=2048
It never started in my configuration .... (4Gb Memory and 800 Mb free)

You Note:

Code:
#NOTE: Only KSM_THRES_CONST or KSM_THRES_COEF is actually used. 
#Whichever results in a larger number wins.
larger was the key to my problem. I reduced THRES_CONST to 1024 and it inmediately started ..
Thanks

Hi vcp_ai!

I was looking at your answer and I'm sorry but it doesn't make any sense!

Reducing the value of KSM_THRES_CONST from 2048 to 1024 will have absolutely no impact whatsoever since this value will never be used!!!

The script /usr/sbin/ksmtuned will first compute the threshold by using the KSM_THRES_COEF parameter (default to 20%) which in your case is equal to this value: 838860 KB (4GB*0.2).

And then it will check if KSM_THRES_CONST is greater than the threshold (from previous step) and if yes will use this value as the new threshold (which will never happen in your case since 1024 < 838860)!

Also the documentation made by e100 is wrong about the KSM_THRES_CONST parameter: the specified value should be in Kilobytes and not Bytes!

I think Proxmox's documentation is wrong too because they say that KSM will kick in as soon as free ram goes below 50% (which is false: default threshold is 20%)?!?!?!

Hope this helps and please correct me If I'm wrong!

Christian
 
  • Like
Reactions: tuxick

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!