On 22.05.23 12:53, Yang Yang wrote:
From: xu xin <xu.xin16@xxxxxxxxxx> 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. Signed-off-by: xu xin <xu.xin16@xxxxxxxxxx> Cc: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Xuexin Jiang <jiang.xuexin@xxxxxxxxxx> Cc: Xiaokai Ran <ran.xiaokai@xxxxxxxxxx> Cc: Yang Yang <yang.yang29@xxxxxxxxxx> ---
LGTM. [inlining inc_ksm_zero_pages() and avoiding explicit dec_ksm_zero_pages() as noted on patch #2 ]
-- Thanks, David / dhildenb