linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: xu.xin.sc@gmail.com
To: akpm@linux-foundation.org
Cc: ran.xiaokai@zte.com.cn, yang.yang29@zte.com.cn,
	jiang.xuexin@zte.com.cn, imbrenda@linux.ibm.com,
	david@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, xu xin <xu.xin16@zte.com.cn>
Subject: [PATCH 0/5] ksm: support tracking KSM-placed zero-pages
Date: Sat,  8 Oct 2022 07:01:56 +0000	[thread overview]
Message-ID: <20221008070156.308465-1-xu.xin16@zte.com.cn> (raw)

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

Before enabling use_zero_pages by setting /sys/kernel/mm/ksm/
use_zero_pages to 1, pages_sharing of KSM is basically accurate. But
when enabling use_zero_pages, all empty pages that are merged with
kernel zero page are not counted in pages_sharing or pages_shared.
That is because these empty pages are merged with zero-pages then no
longer managed 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.

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


*** 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



             reply	other threads:[~2022-10-08  7:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-08  7:01 xu.xin.sc [this message]
2022-10-08  7:05 ` [PATCH 2/5] ksm: support unsharing zero pages placed by KSM xu.xin.sc
2022-10-08  7:06 ` [PATCH 3/5] ksm: count all " xu.xin.sc
2022-10-08  7:06 ` [PATCH 4/5] ksm: count zero pages for each process xu.xin.sc
2022-10-08 13:55   ` kernel test robot
2022-10-08  7:07 ` [PATCH 5/5] ksm: add zero_pages_sharing documentation xu.xin.sc
2022-10-08  7:08 ` [PATCH 1/5] ksm: abstract the function try_to_get_old_rmap_item xu.xin.sc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221008070156.308465-1-xu.xin16@zte.com.cn \
    --to=xu.xin.sc@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=jiang.xuexin@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=xu.xin16@zte.com.cn \
    --cc=yang.yang29@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox