Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xu Xin (vivo)" <xu.xin@linux.dev>
Cc: chengming.zhou@linux.dev, david@kernel.org, linux-mm@kvack.org,
	ljs@kernel.org
Subject: Re: [PATCH 2/2] mm/ksm: add initialization helpers for scan_get_next_rmap_item()
Date: Fri, 13 Nov 2026 13:00:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-212803@kernel.org> (raw)
In-Reply-To: <20261112125959.177881-1-xu.xin@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm/ksm: scan_begin_new_cycle() reorders lru_add_drain_all() at
  scan start
--

commit 82208b052cdf6d037a169e81cb68de5a2ad7f1fc
Author: Xu Xin (vivo) <xu.xin@linux.dev>

mm/ksm: add initialization helpers for scan_get_next_rmap_item()

This commit extracts the new scan cycle check and the first mm_slot lookup
from scan_get_next_rmap_item() into scan_begin_new_cycle() and
scan_get_first_mm().

[Severity: Low]
In mm/ksm.c, does moving lru_add_drain_all() into scan_begin_new_cycle()
change the execution order at the start of a scan cycle in
scan_get_next_rmap_item()?

Previously, when ksm_scan.mm_slot equaled &ksm_mm_head, advisor_start_scan()
and trace_ksm_start_scan() ran before lru_add_drain_all(). Calling
lru_add_drain_all() inside scan_begin_new_cycle() in the if condition runs
it before both calls, contrary to the commit message's statement that the
exact execution order is kept intact.

This reverses the relative order of the mm_lru_add_drain_all and
ksm_start_scan tracepoints. It also records advisor_ctx.start_scan via
ktime_get() in advisor_start_scan() only after lru_add_drain_all() finishes
draining per-CPU LRU caches, whereas scan_time_advisor() still includes the
ksmd CPU runtime spent inside lru_add_drain_all() via
task_sched_runtime(current).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112125754.176930-1-xu.xin@linux.dev?part=2


      reply	other threads:[~2026-11-13 13:00 UTC|newest]

Thread overview: 4+ 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-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 [this message]

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=sashiko-outbox-212803@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chengming.zhou@linux.dev \
    --cc=david@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xu.xin@linux.dev \
    /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