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>
Showing
- fs/proc/base.c 1 addition, 0 deletionsfs/proc/base.c
- include/linux/ksm.h 5 additions, 3 deletionsinclude/linux/ksm.h
- include/linux/mm_types.h 7 additions, 2 deletionsinclude/linux/mm_types.h
- mm/khugepaged.c 1 addition, 1 deletionmm/khugepaged.c
- mm/ksm.c 1 addition, 0 deletionsmm/ksm.c
- mm/memory.c 2 additions, 2 deletionsmm/memory.c
Please register or sign in to comment