On Tue, Jul 27, 2021 at 2:27 PM Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote: > > On Tue, Jul 27, 2021 at 5:04 AM Mike Kravetz <mike.kravetz@xxxxxxxxxx> 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@xxxxxxxxxxxxx> > > > --- > > > 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