linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lucien Wang <lcnwed@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org, trivial@kernel.org,
	 Wang Yibo <wangyibo@uniontech.com>
Subject: Re: [PATCH] mm: move bad zone checking before getting it
Date: Fri, 6 Sep 2024 11:35:15 +0800	[thread overview]
Message-ID: <CAHViUT1xrR5c4c9dbMOwO=dFGKFnxYZw8abpHa0hvkuTW-eX4g@mail.gmail.com> (raw)
In-Reply-To: <50595531-87b0-4420-9624-948810066a6e@redhat.com>

On Thu, Sep 5, 2024 at 6:22 PM David Hildenbrand <david@redhat.com> wrote:
>
> On 05.09.24 11:52, Wang Yibo wrote:
> > When flags from gfp_zone() has an error combination, VM_BUG_ON() should firt know it before use it.
>
> s/firt/first/
>
> Please break long lines. (checkpatch.pl should have warned you)
>
> >
> > Signed-off-by: Wang Yibo <wangyibo@uniontech.com>
> > ---
> >   include/linux/gfp.h | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> > index f53f76e0b17e..ca61b2440ab3 100644
> > --- a/include/linux/gfp.h
> > +++ b/include/linux/gfp.h
> > @@ -133,10 +133,11 @@ static inline enum zone_type gfp_zone(gfp_t flags)
> >   {
> >       enum zone_type z;
> >       int bit = (__force int) (flags & GFP_ZONEMASK);
> > +     VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
>
> Better use VM_WARN_ON_ONCE() instead while at it.
>
> >
> >       z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
> >                                        ((1 << GFP_ZONES_SHIFT) - 1);
> > -     VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> > +
>
> Unrelated whitespace change.
>
> >       return z;
> >   }
> >
>
> But I don't see why we would want this change? It's not like the kernel
> would crash when calculating z.
>
> Or is there some change in behavior I am missing?

On Thu, Sep 5, 2024 at 9:13 PM David Hildenbrand <david@redhat.com> wrote:
>
> On 05.09.24 12:48, Wang Yibo wrote:
> > When flags in gfp_zone() has an error combination,
> > VM_BUG_ON() should first know it before use it.
> >
> > Signed-off-by: Wang Yibo <wangyibo@uniontech.com>
> > ---
> >   include/linux/gfp.h | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> > index f53f76e0b17e..ca61b2440ab3 100644
> > --- a/include/linux/gfp.h
> > +++ b/include/linux/gfp.h
> > @@ -133,10 +133,11 @@ static inline enum zone_type gfp_zone(gfp_t flags)
> >   {
> >       enum zone_type z;
> >       int bit = (__force int) (flags & GFP_ZONEMASK);
> > +     VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> >
> >       z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
> >                                        ((1 << GFP_ZONES_SHIFT) - 1);
> > -     VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> > +
>
> I'm afraid you either missed half my review comments or your answer to
> my mail did not make it to my inbox.

I did not read your first email carefully,Sorry for that.
I will reply to your comments based on your last email.

>
> --
> Cheers,
>
> David / dhildenb
>

>
> --
> Cheers,
>
> David / dhildenb
>


  parent reply	other threads:[~2024-09-06  3:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  9:52 Wang Yibo
2024-09-05 10:22 ` David Hildenbrand
2024-09-05 10:48   ` [PATCH v2 1/1] mm: move bad zone checking in gfp_zone() Wang Yibo
2024-09-05 13:13     ` David Hildenbrand
2024-09-06  3:35   ` Lucien Wang [this message]
2024-09-06  3:50   ` [PATCH] mm: move bad zone checking before getting it Lucien Wang

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='CAHViUT1xrR5c4c9dbMOwO=dFGKFnxYZw8abpHa0hvkuTW-eX4g@mail.gmail.com' \
    --to=lcnwed@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=trivial@kernel.org \
    --cc=wangyibo@uniontech.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