From: "Xu Xin (vivo)" <xu.xin@linux.dev>
To: ljs@kernel.org
Cc: chengming.zhou@linux.dev, david@kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
xu.xin@linux.dev
Subject: Re: [PATCH 2/2] mm/ksm: add initialization helpers for scan_get_next_rmap_item()
Date: Sat, 14 Nov 2026 22:56:16 +0800 [thread overview]
Message-ID: <20261114145616.646190-1-xu.xin@linux.dev> (raw)
In-Reply-To: <avcZQNlZ7cisQAeG@gremlin>
> On Thu, Nov 12, 2026 at 08:59:59PM +0800, Xu Xin (vivo) wrote:
> > Extract the new scan cycle detection (including draining per-CPU LRU
> > caches) and advancing the scan cursor to the first mm_slot into
> > scan_begin_new_cycle() and scan_get_first_mm().
> >
> > This keeps the exact execution order intact while making
> > scan_get_next_rmap_item() cleaner and easier to follow.
> >
> > No functional change intended.
> >
> > Signed-off-by: Xu Xin (vivo) <xu.xin@linux.dev>
>
> Again, thanks for doing this! LGTM and:
>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Thanks.
>
> > +static struct ksm_mm_slot *scan_get_first_mm(void)
> > +{
> > + struct ksm_mm_slot *mm_slot = ksm_scan.mm_slot;
> > + struct mm_slot *slot;
> > +
> > + spin_lock(&ksm_mmlist_lock);
> > +
> > + slot = list_entry(mm_slot->slot.mm_node.next, struct mm_slot, mm_node);
> > + mm_slot = mm_slot_entry(slot, struct ksm_mm_slot, slot);
> > + ksm_scan.mm_slot = mm_slot;
> > +
> > + spin_unlock(&ksm_mmlist_lock);
>
> NIT: optional, but this could be:
>
> scoped_guard(mutex, &ksm_mmlist_lock) {
> slot = list_entry(mm_slot->slot.mm_node.next, struct mm_slot, mm_node);
> mm_slot = mm_slot_entry(slot, struct ksm_mm_slot, slot);
> ksm_scan.mm_slot = mm_slot;
> }
>
>
Good idea, I will switch to scoped_guard.
next prev parent reply other threads:[~2026-11-14 14:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 12:57 [PATCH 0/2] mm/ksm: clean up scan_get_next_rmap_item() initialization Xu Xin (vivo)
2026-11-12 12:59 ` [PATCH 1/2] mm/ksm: extract helper functions for scan cycle cleanup Xu Xin (vivo)
2026-11-13 14:03 ` Lorenzo Stoakes (ARM)
2026-11-13 19:07 ` David Hildenbrand (Arm)
2026-11-12 12:59 ` [PATCH 2/2] mm/ksm: add initialization helpers for scan_get_next_rmap_item() Xu Xin (vivo)
2026-11-13 13:00 ` sashiko-bot
2026-11-13 14:09 ` Lorenzo Stoakes (ARM)
2026-11-14 14:56 ` Xu Xin (vivo) [this message]
2026-11-13 19:10 ` David Hildenbrand (Arm)
2026-11-14 14:43 ` 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=20261114145616.646190-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