After you reboot with our uksm enabled kernel, uksm works as a system daemon — uksmd. The main interface for uksmd is under
The meaning of each file in this directory is as below:
- run : The main control interface to stop/run. e.g. echo 1 > run.
- scan_batch_pages: how many pages uksmd will scan for each wake up
- sleep_millisecs: how long will uksmd sleep before it wakes up and does its work.
- thrash_threshold: the percentage of the COWed ksm page you can tolerate for a memory area. The areas causing a thrashing ratio above this value will be degraded to a slow scan speed, since they are not deduplication friendly.
- min_scan_ratio: how many pages you want uksmd to sample for each memory area. This is the minimum value, in unit of 1/125.
- usr_spt_enabled: Testing interface for future feature of “remote bug reporting”. Currently this interface is enabled by default for testing —- this will make uksmd send a meaningless udp message from your machine every 2 mintues. You can disable it by echo 0 > usr_spt_enabled.
- usr_spt_flags: Reserved for “remote bug reporting”, useless for the time being.
- usr_spt_msg: Reserved for “remote bug reporting”, useless for the time being.
- full_scans: how many times uksmd sampling has covered all of your memory areas.
- hash_strength: the current hash strength for adaptive-random-sampling hashing algorithm. The lower the faster uksmd gonna merge pages. Its range is 1 ~ 1034.
- pages_scanned: how many pages has been scanned.
- pages_shared: how many pages has been mapped by different page table entries, i.e. shared by different processes.
- pages_sharing: this is roughly the number of redundant pages you have saved, with uksm.
- sleep_times: how many times uksmd has waken up and then got sleep.
- Since version of 0.1.1，the pages with full zeros will considered specially and seperately. You can get the information for uksmd merged zero pages by “cat /proc/meminfo | grep KsmZeroPages”.
Please note that uksm is smart. So for most of the time, using uksm means only “echo 1 > /sys/kernel/mm/uksm/run”（it’s enabled by default now）. But if you find that uksmd is grasping too much of you CPU, you can reduce “scan_batch_pages”. Be aware, this number is not linear to CPU consumption, try to reduce it by half each time.