summaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorxu xin <xu.xin16@zte.com.cn>2023-06-13 11:09:38 +0800
committerAndrew Morton <akpm@linux-foundation.org>2023-08-18 10:12:10 -0700
commit6080d19f07043ade61094d0f58b14c05e1694a39 (patch)
tree69a1aae1ba5e5f8fdc67f7dc9e3f4f89fea44f97 /mm/memory.c
parente2942062e01df85b4692460fe5b48ab0c90fdb95 (diff)
downloadlinux-stable-6080d19f07043ade61094d0f58b14c05e1694a39.tar.gz
linux-stable-6080d19f07043ade61094d0f58b14c05e1694a39.tar.bz2
linux-stable-6080d19f07043ade61094d0f58b14c05e1694a39.zip
ksm: add ksm zero pages for each process
As the number of ksm zero pages is not included in ksm_merging_pages per process when enabling use_zero_pages, it's unclear of how many actual pages are merged by KSM. To let users accurately estimate their memory demands when unsharing KSM zero-pages, it's necessary to show KSM zero- pages per process. In addition, it help users to know the actual KSM profit because KSM-placed zero pages are also benefit from KSM. since unsharing zero pages placed by KSM accurately is achieved, then tracking empty pages merging and unmerging is not a difficult thing any longer. Since we already have /proc/<pid>/ksm_stat, just add the information of 'ksm_zero_pages' in it. Link: https://lkml.kernel.org/r/20230613030938.185993-1-yang.yang29@zte.com.cn Signed-off-by: xu xin <xu.xin16@zte.com.cn> Acked-by: David Hildenbrand <david@redhat.com> Reviewed-by: Xiaokai Ran <ran.xiaokai@zte.com.cn> Reviewed-by: Yang Yang <yang.yang29@zte.com.cn> Cc: Claudio Imbrenda <imbrenda@linux.ibm.com> Cc: Xuexin Jiang <jiang.xuexin@zte.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c
index c256da05bb5e..5f863b1a0edc 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1434,7 +1434,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
zap_install_uffd_wp_if_needed(vma, addr, pte, details,
ptent);
if (unlikely(!page)) {
- ksm_might_unmap_zero_page(ptent);
+ ksm_might_unmap_zero_page(mm, ptent);
continue;
}
@@ -3130,7 +3130,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf)
inc_mm_counter(mm, MM_ANONPAGES);
}
} else {
- ksm_might_unmap_zero_page(vmf->orig_pte);
+ ksm_might_unmap_zero_page(mm, vmf->orig_pte);
inc_mm_counter(mm, MM_ANONPAGES);
}
flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte));