linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] ksm: support tracking KSM-placed zero-pages
@ 2022-10-11  2:20 xu.xin.sc
  2022-10-11  2:21 ` [PATCH v3 1/5] ksm: abstract the function try_to_get_old_rmap_item xu.xin.sc
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: xu.xin.sc @ 2022-10-11  2:20 UTC (permalink / raw)
  To: akpm
  Cc: ran.xiaokai, yang.yang29, jiang.xuexin, imbrenda, david,
	linux-mm, linux-kernel, xu xin

From: xu xin <xu.xin16@zte.com.cn>

use_zero_pages is good, not just because of cache colouring as described
in doc, but also because use_zero_pages can accelerate merging empty pages
when there are plenty of empty pages (full of zeros) as the time of
page-by-page comparisons (unstable_tree_search_insert) is saved.

But there is something to improve, that is, when enabling use_zero_pages,
all empty pages will be merged with kernel zero pages instead of with each
other as use_zero_pages is disabled, and then these zero-pages are no longer
managed and monitor by KSM, which leads to two issues at least:

1) MADV_UNMERGEABLE and other ways to trigger unsharing will *not*
   unshare the shared zeropage as placed by KSM (which is against the 
   MADV_UNMERGEABLE documentation at least); see the link:
   https://lore.kernel.org/lkml/4a3daba6-18f9-d252-697c-197f65578c44@redhat.com/

2) we cannot know how many pages are zero pages placed by KSM when
   enabling use_zero_pages, which leads to KSM not being transparent
   with all actual merged pages by KSM.

Zero pages may be the most common merged pages in actual environment(not only VM but
also including other application like containers). Enabling use_zero_pages in the
environment with plenty of empty pages(full of zeros) will be very useful. Users and
app developer can also benefit from knowing the proportion of zero pages in all
merged pages to optimize applications.

With the patch series, we can both unshare zero-pages(KSM-placed) accurately
and count ksm zero pages with enabling use_zero_pages.

---
v2->v3:

1) Add more descriptive information in cover letter.

2) In [patch 2/5], add more commit log for explaining reasons.

3) In [patch 2/5], fix misuse of break_ksm() in unmerge_ksm_pages():
   break_ksm(vma, addr, NULL) -> break_ksm(vma, addr, false);

---
v1->v2:

[patch 4/5] fix build warning, mm/ksm.c:550, misleading indentation; statement 
'rmap_item->mm->ksm_zero_pages_sharing--;' is not part of the previous 'if'.



*** BLURB HERE ***

xu xin (5):
  ksm: abstract the function try_to_get_old_rmap_item
  ksm: support unsharing zero pages placed by KSM
  ksm: count all zero pages placed by KSM
  ksm: count zero pages for each process
  ksm: add zero_pages_sharing documentation

 Documentation/admin-guide/mm/ksm.rst |  10 +-
 fs/proc/base.c                       |   1 +
 include/linux/mm_types.h             |   7 +-
 mm/ksm.c                             | 177 +++++++++++++++++++++------
 4 files changed, 157 insertions(+), 38 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-11-14  3:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-11  2:20 [PATCH v3 0/5] ksm: support tracking KSM-placed zero-pages xu.xin.sc
2022-10-11  2:21 ` [PATCH v3 1/5] ksm: abstract the function try_to_get_old_rmap_item xu.xin.sc
2022-10-11  2:22 ` [PATCH v3 2/5] ksm: support unsharing zero pages placed by KSM xu.xin.sc
2022-10-21 10:17   ` David Hildenbrand
2022-10-21 12:54     ` David Hildenbrand
2022-11-09 10:40       ` David Hildenbrand
2022-11-14  3:02         ` xu xin
2022-10-11  2:22 ` [PATCH v3 3/5] ksm: count all " xu.xin.sc
2022-10-11  2:22 ` [PATCH v3 4/5] ksm: count zero pages for each process xu.xin.sc
2022-10-11  2:23 ` [PATCH v3 5/5] ksm: add zero_pages_sharing documentation xu.xin.sc
2022-10-17 23:55 ` [PATCH v3 0/5] ksm: support tracking KSM-placed zero-pages Andrew Morton
2022-10-18  9:00   ` xu xin
2022-10-18 22:54     ` [PATCH " Andrew Morton
2022-10-21 10:18       ` David Hildenbrand
2022-10-24  3:07         ` xu xin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox