All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: xu.xin16@zte.com.cn, akpm@linux-foundation.org, chengming.zhou@linux.dev
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/ksm: Initialize the addr only once in collect_procs_ksm
Date: Wed, 8 Jul 2026 09:53:47 +0200	[thread overview]
Message-ID: <38ad90d8-0887-4cb9-b874-53ce35b6dbfe@kernel.org> (raw)
In-Reply-To: <202607081219094603lvrfl0HWd-31cAGrp79l@zte.com.cn>

On 7/8/26 06:19, xu.xin16@zte.com.cn wrote:
> From: xu xin <xu.xin16@zte.com.cn>
> 
> Similar with 318d87b8fa7 ("ksm: initialize the addr only once in rmap_walk_ksm"),

checkpatch.pl should complain here

"Similar as commit 318d87b8fa7 ("ksm: initialize the addr only once in
rmap_walk_ksm")," ...

> Only initialize the addr only once in rmap_walk_ksm because the addr variable

s/Only/only/, but you une one "only" too much here.

> doesn't change across iterations.
> 
> Signed-off-by: Xu Xin <xu.xin16@zte.com>
> ---
>  mm/ksm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index c1dcc3cb4831..337eb04a9340 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -3289,7 +3289,7 @@ void collect_procs_ksm(const struct folio *folio, const struct page *page,
>  		rcu_read_lock();
>  		for_each_process(tsk) {
>  			struct anon_vma_chain *vmac;
> -			unsigned long addr;
> +			const unsigned long addr = rmap_item->address & PAGE_MASK;
>  			struct task_struct *t =
>  				task_early_kill(tsk, force_early);
>  			if (!t)
> @@ -3299,7 +3299,6 @@ void collect_procs_ksm(const struct folio *folio, const struct page *page,
>  			{
>  				vma = vmac->vma;
>  				if (vma->vm_mm == t->mm) {
> -					addr = rmap_item->address & PAGE_MASK;
>  					add_to_kill_ksm(t, page, vma, to_kill,
>  							addr);
>  				}


-- 
Cheers,

David

  parent reply	other threads:[~2026-07-08  7:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  3:38 [PATCH RESEND 0/2] KSM: use linear_page_index in collect_procs_ksm() xu.xin16
2026-07-08  4:19 ` [PATCH 1/2] mm/ksm: Initialize the addr only once in collect_procs_ksm xu.xin16
2026-07-08  7:50   ` David Hildenbrand (Arm)
2026-07-08  7:53   ` David Hildenbrand (Arm) [this message]
2026-07-08  4:22 ` [PATCH RESEND 2/2] mm/ksm: Use precise linear_page_index instead of the whole address space xu.xin16
2026-07-08  7:52   ` David Hildenbrand (Arm)
2026-07-09  3:10     ` xu.xin16
2026-07-09  8:53       ` David Hildenbrand (Arm)
     [not found] <20260708112943731Lz7DsMxSAWtV6I69GjZmU@zte.com.cn>
2026-07-08  3:33 ` [PATCH 1/2] mm/ksm: Initialize the addr only once in collect_procs_ksm xu.xin16

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=38ad90d8-0887-4cb9-b874-53ce35b6dbfe@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xu.xin16@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.