Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joshua Hahn" <joshua.hahnjy@gmail.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Vlastimil Babka" <vbabka@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Brendan Jackman" <brendan.jackman@linux.dev>,
	"Zi Yan" <ziy@nvidia.com>,
	linux-mm@kvack.org, kernel-team@meta.com
Subject: Re: [PATCH 1/3] mm/page_alloc: drop the pcp lock before enabling IRQs after a drain
Date: Thu, 26 Nov 2026 21:27:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-236231@kernel.org> (raw)
In-Reply-To: <20261125212730.1128631-2-joshua.hahnjy@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm/page_alloc: unused-but-set flags variable in
  free_frozen_page_commit()
--

commit d66ecc1b75f6ab35dc480b529fcd4baafd313549
Author: Joshua Hahn <joshua.hahnjy@gmail.com>

mm/page_alloc: drop the pcp lock before enabling IRQs after a drain

This commit disables IRQs before calling free_pcppages_bulk() and
restores them only after dropping the pcp lock, returning with the pcp
unlocked after draining pages.

> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index aa1ed599c7c6b..bc272f8d8ec75 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -153,6 +165,9 @@ static DEFINE_MUTEX(pcp_batch_high_lock);
>  
>  #define pcp_spin_unlock(ptr)		\
>  		BUG_ON(1)
> +
> +#define pcp_spin_unlock_irqrestore(ptr, flags)	\
> +		BUG_ON(1)
>  #endif

[ ... ]

> @@ -2904,14 +2919,19 @@ static bool free_frozen_page_commit(struct zone *zone,
>  
>  	to_free = nr_pcp_free(pcp, batch, high, free_high);
>  	while (to_free > 0 && pcp->count > 0) {
> +		unsigned long flags = 0;
> +
>  		to_free_batched = min(to_free, batch);
> +		if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> +			local_irq_save(flags);
>  		free_pcppages_bulk(zone, to_free_batched, pcp, pindex);
>  		to_free -= to_free_batched;
> +		pcp_spin_unlock_irqrestore(pcp, flags);

[Severity: Low]
Does this trigger a -Wunused-but-set-variable warning on flags when built
with CONFIG_SMP=n, CONFIG_TRACE_IRQFLAGS=n, and W=1?  With
CONFIG_TRACE_IRQFLAGS=n, local_irq_save(flags) only writes to flags, and
the !CONFIG_SMP definition of pcp_spin_unlock_irqrestore(ptr, flags) does
not evaluate flags.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125212730.1128631-1-joshua.hahnjy@gmail.com?part=1


  reply	other threads:[~2026-11-26 21:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 21:27 [PATCH 0/3] mm/page_alloc: drop the pcp lock before re-enabling IRQs Joshua Hahn
2026-11-25 21:27 ` [PATCH 1/3] mm/page_alloc: drop the pcp lock before enabling IRQs after a drain Joshua Hahn
2026-11-26 21:27   ` sashiko-bot [this message]
2026-11-25 21:27 ` [PATCH 2/3] mm/page_alloc: drop the pcp lock before enabling IRQs after a refill Joshua Hahn
2026-11-25 21:27 ` [PATCH 3/3] mm/page_alloc: disable IRQs around the remaining pcp drains Joshua Hahn

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-236231@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brendan.jackman@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=ziy@nvidia.com \
    /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