From: "Xu Xin (vivo)" <xu.xin@linux.dev>
To: David Hildenbrand <david@kernel.org>
Cc: chengming.zhou@linux.dev, ljs@kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
xu.xin@linux.dev
Subject: [PATCH v2 0/2] mm/ksm: clean up scan_get_next_rmap_item() initialization
Date: Sun, 15 Nov 2026 15:58:32 +0800 [thread overview]
Message-ID: <20261115075832.132109-1-xu.xin@linux.dev> (raw)
Currently, scan_get_next_rmap_item() has grown quite large and complex.
When introducing new features, such as the only-merge-zero-page mode we
are currently working on, we don't want to add more complexity to it
and don't want to touch rmap_item structures to avoid unnecessary overhead,
so we need to extract some common logic.
With these changes, the entry of scan_get_next_rmap_item() becomes much
cleaner and easier to follow, instead of being cluttered with unrelated
boilerplate such as stale stable_node pruning and cycle initialization.
Let's start by cleaning up these two parts at the beginning (where I think
abstraction is necessary), and we can continue cleaning up further if
needed later.
Changes in v2:
- Rename scan_begin_new_cycle() to scan_should_start_new_cycle() and keep
it simple (David).
- Keep lru_add_drain_all() in scan_get_next_rmap_item() (David).
- Use scoped_guard(spinlock, &ksm_mmlist_lock) in scan_get_first_mm()
(Lorenzo).
- Collect Reviewed-by and Acked-by tags from v1.
Xu Xin (vivo) (2):
mm/ksm: extract helper functions for scan cycle cleanup
mm/ksm: add initialization helpers for scan_get_next_rmap_item()
mm/ksm.c | 98 +++++++++++++++++++++++++++++++++++---------------------
1 file changed, 62 insertions(+), 36 deletions(-)
--
2.34.1
next reply other threads:[~2026-11-15 7:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 7:58 Xu Xin (vivo) [this message]
2026-11-15 8:00 ` [PATCH v2 1/2] mm/ksm: extract helper functions for scan cycle cleanup Xu Xin (vivo)
2026-11-15 8:00 ` [PATCH v2 2/2] mm/ksm: add initialization helpers for scan_get_next_rmap_item() Xu Xin (vivo)
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=20261115075832.132109-1-xu.xin@linux.dev \
--to=xu.xin@linux.dev \
--cc=chengming.zhou@linux.dev \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
/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
all inboxes | Powered by JetHome®