Messages in this thread | | | From | Muchun Song <> | Date | Tue, 27 Jul 2021 14:27:31 +0800 | Subject | Re: [PATCH 1/5] mm: introduce PAGEFLAGS_MASK to replace ((1UL << NR_PAGEFLAGS) - 1) |
| |
On Tue, Jul 27, 2021 at 5:04 AM Mike Kravetz <mike.kravetz@oracle.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@bytedance.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 know if this is an unwritten rule. Please correct me if I am wrong.
Thanks.
> -- > Mike Kravetz
| |