linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-mm@kvack.org
Subject: Re: [bug report] mm: reduce noise in show_mem for lowmem allocations
Date: Tue, 30 Aug 2022 09:11:03 +0200	[thread overview]
Message-ID: <Yw24ByJ32Xy6i8av@dhcp22.suse.cz> (raw)
In-Reply-To: <20220830070205.GQ2030@kadam>

On Tue 30-08-22 10:02:05, Dan Carpenter wrote:
> On Tue, Aug 30, 2022 at 08:46:58AM +0200, Michal Hocko wrote:
> > On Tue 30-08-22 09:30:26, Dan Carpenter wrote:
> > > Hello Michal Hocko,
> > > 
> > > The patch e8fedfea3dea: "mm: reduce noise in show_mem for lowmem
> > > allocations" from Aug 23, 2022, leads to the following Smatch static
> > > checker warning:
> > > 
> > > 	kernel/panic.c:190 panic_print_sys_info()
> > > 	warn: sleeping in atomic context
> > 
> > What is this warning saying?
> > 
> 
> This is a Smatch warning.
> 
> > >     189         if (panic_print & PANIC_PRINT_MEM_INFO)
> > > --> 190                 show_mem(0, NULL, GFP_HIGHUSER_MOVABLE);
> > >                                           ^^^^^^^^^^^^^^^^^^^^
> > > This obviously seems very deliberate and a lot of weird stuff happens
> > > during panic().  But the panic() function disables preemption so
> > > shouldn't this be GFP_ATOMIC?  GFP_HIGHUSER_MOVABLE has __GFP_RECLAIM
> > > and triggering swap during a panic seems bad.
> > 
> > This function shouldn't ever be allocating any memory. The flag is
> > solely to infer which memory zones should be displayed. It acts as a
> > filter. Is it possible that the checker misinterprets the parameter's
> > meaning?
> 
> Ah.  Yes.  Smatch sees every gfp_t as a sleep/no sleep marker.  I
> didn't realize it wasn't used like that here.  Thanks!

OK, fair enough and I can actually see how that can turn out into a real
allocation in a distant future when the original intention has been lost
in the past. Let me re-open the discussion for that patch and CC you
there.

Thanks for the report.
-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2022-08-30  7:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30  6:30 Dan Carpenter
2022-08-30  6:46 ` Michal Hocko
2022-08-30  7:02   ` Dan Carpenter
2022-08-30  7:11     ` Michal Hocko [this message]
2022-08-30  7:59       ` Dan Carpenter

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=Yw24ByJ32Xy6i8av@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-mm@kvack.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