From: Muchun Song <songmuchun@bytedance.com>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Oscar Salvador <osalvador@suse.de>,
Michal Hocko <mhocko@suse.com>,
"Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>,
David Hildenbrand <david@redhat.com>,
Chen Huang <chenhuang5@huawei.com>,
"Bodeddula, Balasubramaniam" <bodeddub@amazon.com>,
Jonathan Corbet <corbet@lwn.net>,
Xiongchun duan <duanxiongchun@bytedance.com>,
fam.zheng@bytedance.com, linux-doc@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Qi Zheng <zhengqi.arch@bytedance.com>
Subject: Re: [PATCH 1/5] mm: introduce PAGEFLAGS_MASK to replace ((1UL << NR_PAGEFLAGS) - 1)
Date: Thu, 29 Jul 2021 14:00:28 +0800 [thread overview]
Message-ID: <CAMZfGtXmNSg2mNsdG20JDzZofMSdreYOiKCO1WQ+zAEomkozyw@mail.gmail.com> (raw)
In-Reply-To: <CAMZfGtUtk9uyO7v0v94YqLaHhrZ-CoFvVH60n54apib7PHPcKw@mail.gmail.com>
On Tue, Jul 27, 2021 at 2:27 PM Muchun Song <songmuchun@bytedance.com> wrote:
>
> 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
^^^
Sorry. I mean 0xff...ff00...00 here.
> know if this is an unwritten rule. Please correct me if I am
> wrong.
>
> Thanks.
>
> > --
> > Mike Kravetz
next prev parent reply other threads:[~2021-07-29 6:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 9:17 [PATCH 0/5] Free the 2nd vmemmap page associated with each HugeTLB page Muchun Song
2021-07-14 9:17 ` [PATCH 1/5] mm: introduce PAGEFLAGS_MASK to replace ((1UL << NR_PAGEFLAGS) - 1) Muchun Song
2021-07-26 21:04 ` Mike Kravetz
2021-07-27 6:27 ` Muchun Song
2021-07-29 6:00 ` Muchun Song [this message]
2021-07-14 9:17 ` [PATCH 2/5] mm: introduce save_page_flags to cooperate with show_page_flags Muchun Song
2021-07-26 23:18 ` Mike Kravetz
2021-07-27 7:06 ` Muchun Song
2021-07-14 9:17 ` [PATCH 3/5] mm: hugetlb: free the 2nd vmemmap page associated with each HugeTLB page Muchun Song
2021-07-26 21:16 ` Matthew Wilcox
2021-07-26 23:56 ` Mike Kravetz
2021-07-27 7:15 ` Muchun Song
2021-07-14 9:17 ` [PATCH 4/5] mm: hugetlb: replace hugetlb_free_vmemmap_enabled with a static_key Muchun Song
2021-07-14 9:18 ` [PATCH 5/5] mm: sparsemem: use page table lock to protect kernel pmd operations Muchun Song
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=CAMZfGtXmNSg2mNsdG20JDzZofMSdreYOiKCO1WQ+zAEomkozyw@mail.gmail.com \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=bodeddub@amazon.com \
--cc=chenhuang5@huawei.com \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=duanxiongchun@bytedance.com \
--cc=fam.zheng@bytedance.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=osalvador@suse.de \
--cc=song.bao.hua@hisilicon.com \
--cc=zhengqi.arch@bytedance.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;
as well as URLs for NNTP newsgroup(s).