linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: sunran001@208suo.com, dennis@kernel.org, tj@kernel.org,
	cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/percpu.c: change GFP_KERNEL to GFP_ATOMIC
Date: Fri, 21 Jul 2023 07:43:09 +0800	[thread overview]
Message-ID: <ZLnGjanv23R8O4FU@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20230718101735.aa31791899e2f9e19e8e0a75@linux-foundation.org>

On 07/18/23 at 10:17am, Andrew Morton wrote:
> On Tue, 18 Jul 2023 14:35:11 +0800 sunran001@208suo.com wrote:
> 
> > ERROR: function pcpu_balance_populated called on line 2238 inside lock
> > on line 2234 but uses GFP_KERNEL
> > 
> > Generated by: scripts/coccinelle/locks/call_kern.cocci
> > 
> > ...
> >
> > --- a/mm/percpu.c
> > +++ b/mm/percpu.c
> > @@ -2033,7 +2033,7 @@ static void pcpu_balance_free(bool empty_only)
> >   static void pcpu_balance_populated(void)
> >   {
> >       /* gfp flags passed to underlying allocators */
> > -    const gfp_t gfp = GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN;
> > +    const gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN;
> >       struct pcpu_chunk *chunk;
> >       int slot, nr_to_pop, ret;
> 
> I don't believe this warning is correct.  

Yeah, the warning is false positive. It releases the lock when
requesting memory allocation, then take the lock again.

> 
> 			spin_unlock_irq(&pcpu_lock);
> 			ret = pcpu_populate_chunk(chunk, rs, rs + nr, gfp);
> 			cond_resched();
> 			spin_lock_irq(&pcpu_lock);
> 



      reply	other threads:[~2023-07-20 23:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230718063328.16140-1-xujianghui@cdjrlc.com>
     [not found] ` <7aa3a1cee63518cb13906d11ea130c9c@208suo.com>
2023-07-18 17:17   ` Andrew Morton
2023-07-20 23:43     ` Baoquan He [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=ZLnGjanv23R8O4FU@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dennis@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sunran001@208suo.com \
    --cc=tj@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