lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMZfGtXmNSg2mNsdG20JDzZofMSdreYOiKCO1WQ+zAEomkozyw@mail.gmail.com>
Date:   Thu, 29 Jul 2021 14:00:28 +0800
From:   Muchun Song <songmuchun@...edance.com>
To:     Mike Kravetz <mike.kravetz@...cle.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Oscar Salvador <osalvador@...e.de>,
        Michal Hocko <mhocko@...e.com>,
        "Song Bao Hua (Barry Song)" <song.bao.hua@...ilicon.com>,
        David Hildenbrand <david@...hat.com>,
        Chen Huang <chenhuang5@...wei.com>,
        "Bodeddula, Balasubramaniam" <bodeddub@...zon.com>,
        Jonathan Corbet <corbet@....net>,
        Xiongchun duan <duanxiongchun@...edance.com>,
        fam.zheng@...edance.com, linux-doc@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Qi Zheng <zhengqi.arch@...edance.com>
Subject: Re: [PATCH 1/5] mm: introduce PAGEFLAGS_MASK to replace ((1UL <<
 NR_PAGEFLAGS) - 1)

On Tue, Jul 27, 2021 at 2:27 PM Muchun Song <songmuchun@...edance.com> wrote:
>
> On Tue, Jul 27, 2021 at 5:04 AM Mike Kravetz <mike.kravetz@...cle.com> wrote:
> >
> > On 7/14/21 2:17 AM, Muchun Song wrote:
> > > Instead of hard-coding ((1UL << NR_PAGEFLAGS) - 1) everywhere, introducing
> > > PAGEFLAGS_MASK to make the code clear to get the page flags.
> > >
> > > Signed-off-by: Muchun Song <songmuchun@...edance.com>
> > > ---
> > >  include/linux/page-flags.h      | 4 +++-
> > >  include/trace/events/page_ref.h | 4 ++--
> > >  lib/test_printf.c               | 2 +-
> > >  lib/vsprintf.c                  | 2 +-
> > >  4 files changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> > > index 5922031ffab6..358d3f6fa976 100644
> > > --- a/include/linux/page-flags.h
> > > +++ b/include/linux/page-flags.h
> > > @@ -178,6 +178,8 @@ enum pageflags {
> > >       PG_reported = PG_uptodate,
> > >  };
> > >
> > > +#define PAGEFLAGS_MASK               (~((1UL << NR_PAGEFLAGS) - 1))
> >
> > Can you explain why you chose this definition instead of
> >
> > #define PAGEFLAGS_MASK          ((1UL << NR_PAGEFLAGS) - 1)
> >
> > and mostly use ~PAGEFLAGS_MASK below?
>
> Hi Mike,
>
> Actually, I learned from PAGE_MASK. So I thought the macro
> like xxx_MASK should be the format of 0x00...00ff...ff. I don't
                                           ^^^
Sorry. I mean 0xff...ff00...00 here.

> know if this is an unwritten rule. Please correct me if I am
> wrong.
>
> Thanks.
>
> > --
> > Mike Kravetz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ