On 2024/6/21 03:38, David Hildenbrand wrote:
On 20.06.24 06:39, Sung-hun Kim wrote:
The current version of KSM does not take into account the number of
used ksm_mm_slot. Therefore, when users want to obtain profits of
KSM, KSM omits the memory used for allocating ksm_mm_slots.
This patch introduces a new variable to keep track of the number of
allocated ksm_mm_slots. By doing so, KSM will be able to provide a
more accurate number of the gains made.
If you take a look at the calculation explained in
Documentation/admin-guide/mm/ksm.rst, we only care about rmap_items,
which can grow rather substantially in size.
We also don't consider other metadata, such as the size of the stable
nodes etc. So why should the ksm_mm_slots matter that much that we
should track them and account them?
BTW, the size of stable_nodes should be more than these mm_slots,
we have one stable_nodes for each KSM page now.
But agree, we only care about the rmap_items, which is the majority
of used memory resource in KSM.