Skip to content
Permalink
Browse files
mm/vmstat: add event for ksm swapping in copy
When faults in from swap what used to be a KSM page and that page
had been swapped in before, system has to make a copy, and leaves
remerging the pages to a later pass of ksmd.

That is not good for performace, we'd better to reduce this kind
of copy. There are some ways to reduce it, for example lessen
swappiness or madvise(, , MADV_MERGEABLE) range. So add this
event to support doing this tuning. Just like this patch:
"mm, THP, swap: add THP swapping out fallback counting".

Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
Reviewed-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
  • Loading branch information
yangyang20220519 authored and intel-lab-lkp committed Jan 12, 2022
1 parent b828014 commit 56a4520e557228d8383f27b6aef54b2f931a0588
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
@@ -126,6 +126,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
#ifdef CONFIG_SWAP
SWAP_RA,
SWAP_RA_HIT,
#ifdef CONFIG_KSM
KSM_SWPIN_COPY,
#endif
#endif
#ifdef CONFIG_X86
DIRECT_MAP_LEVEL2_SPLIT,
@@ -2594,6 +2594,7 @@ struct page *ksm_might_need_to_copy(struct page *page,
SetPageDirty(new_page);
__SetPageUptodate(new_page);
__SetPageLocked(new_page);
count_vm_event(KSM_SWPIN_COPY);
}

return new_page;
@@ -1382,6 +1382,9 @@ const char * const vmstat_text[] = {
#ifdef CONFIG_SWAP
"swap_ra",
"swap_ra_hit",
#ifdef CONFIG_KSM
"ksm_swpin_copy",
#endif
#endif
#ifdef CONFIG_X86
"direct_map_level2_splits",

0 comments on commit 56a4520

Please sign in to comment.