From: Michal Hocko <mhocko@suse.com>
To: Yang Shi <shy828301@gmail.com>
Cc: zokeefe@google.com, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [v2 PATCH 2/2] mm: don't warn if the node is offlined
Date: Fri, 4 Nov 2022 20:51:17 +0100 [thread overview]
Message-ID: <Y2VtNfkwciJ5hHF6@dhcp22.suse.cz> (raw)
In-Reply-To: <CAHbLzkpvZ05+xSGWLCYKJntsLGzdda449XpjCH7sRE-3S8h+0g@mail.gmail.com>
On Fri 04-11-22 10:42:45, Yang Shi wrote:
> On Fri, Nov 4, 2022 at 2:56 AM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Fri 04-11-22 10:35:21, Michal Hocko wrote:
> > [...]
> > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> > > index ef4aea3b356e..308daafc4871 100644
> > > --- a/include/linux/gfp.h
> > > +++ b/include/linux/gfp.h
> > > @@ -227,7 +227,10 @@ static inline
> > > struct folio *__folio_alloc_node(gfp_t gfp, unsigned int order, int nid)
> > > {
> > > VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
> > > - VM_WARN_ON((gfp & __GFP_THISNODE) && !node_online(nid));
> > > + if((gfp & __GFP_THISNODE) && !node_online(nid)) {
> >
> > or maybe even better
> > if ((gfp & (__GFP_THISNODE|__GFP_NOWARN) == __GFP_THISNODE|__GFP_NOWARN) && !node_online(nid))
> >
> > because it doesn't really make much sense to dump this information if
> > the allocation failure is going to provide sufficient (and even more
> > comprehensive) context for the failure. It looks more hairy but this can
> > be hidden in a nice little helper shared between the two callers.
>
> Thanks a lot for the suggestion, printing warning if the gfp flag
> allows sounds like a good idea to me. Will adopt it. But the check
> should look like:
>
> if ((gfp & __GFP_THISNODE) && !(gfp & __GFP_NOWARN) && !node_online(nid))
The idea was to warn if __GFP_NOWARN _was_ specified. Otherwise we will
get an allocation failure splat from the page allocator and there it
will be clear that the node doesn't have any memory associated. It is
exactly __GFP_NOWARN case that would be a silent failure and potentially
a buggy code (like this THP collapse path). See my point?
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2022-11-04 19:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 21:36 [v2 PATCH 1/2] mm: khugepaged: allow page allocation fallback to eligible nodes Yang Shi
2022-11-03 21:36 ` [v2 PATCH 2/2] mm: don't warn if the node is offlined Yang Shi
2022-11-04 9:35 ` Michal Hocko
2022-11-04 9:56 ` Michal Hocko
2022-11-04 17:42 ` Yang Shi
2022-11-04 19:51 ` Michal Hocko [this message]
2022-11-04 20:52 ` Yang Shi
2022-11-07 7:55 ` Michal Hocko
2022-11-07 18:48 ` Yang Shi
2022-11-08 0:58 ` Zach O'Keefe
2022-11-03 23:58 ` [v2 PATCH 1/2] mm: khugepaged: allow page allocation fallback to eligible nodes Zach O'Keefe
2022-11-04 20:39 ` Yang Shi
2022-11-04 8:32 ` Michal Hocko
2022-11-04 17:37 ` Yang Shi
2022-11-04 19:55 ` Michal Hocko
2022-11-04 20:40 ` Yang Shi
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=Y2VtNfkwciJ5hHF6@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
--cc=zokeefe@google.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