[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtUsqkk1Td3YBb-Ap6M_Hg59te1uORCPLVk4QeaFt7U0cw@mail.gmail.com>
Date: Wed, 18 Nov 2020 10:43:06 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: "Song Bao Hua (Barry Song)" <song.bao.hua@...ilicon.com>,
"corbet@....net" <corbet@....net>,
"mike.kravetz@...cle.com" <mike.kravetz@...cle.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "x86@...nel.org" <x86@...nel.org>,
"hpa@...or.com" <hpa@...or.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"luto@...nel.org" <luto@...nel.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"paulmck@...nel.org" <paulmck@...nel.org>,
"mchehab+huawei@...nel.org" <mchehab+huawei@...nel.org>,
"pawan.kumar.gupta@...ux.intel.com"
<pawan.kumar.gupta@...ux.intel.com>,
"rdunlap@...radead.org" <rdunlap@...radead.org>,
"oneukum@...e.com" <oneukum@...e.com>,
"anshuman.khandual@....com" <anshuman.khandual@....com>,
"jroedel@...e.de" <jroedel@...e.de>,
"almasrymina@...gle.com" <almasrymina@...gle.com>,
"rientjes@...gle.com" <rientjes@...gle.com>,
"osalvador@...e.de" <osalvador@...e.de>,
"mhocko@...e.com" <mhocko@...e.com>,
"duanxiongchun@...edance.com" <duanxiongchun@...edance.com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: Re: [External] RE: [PATCH v4 00/21] Free some vmemmap pages of
hugetlb page
On Wed, Nov 18, 2020 at 3:22 AM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Wed, Nov 18, 2020 at 12:29:07AM +0800, Muchun Song wrote:
> > > ideally, we should be able to free PageTail if we change struct page in some way.
> > > Then we will save much more for 2MB hugetlb. but it seems it is not easy.
> >
> > Now for the 2MB HugrTLB page, we only free 6 vmemmap pages.
> > But your words woke me up. Maybe we really can free 7 vmemmap
> > pages. In this case, we can see 8 of the 512 struct page structures
> > has beed set PG_head flag. If we can adjust compound_head()
> > slightly and make compound_head() return the real head struct
> > page when the parameter is the tail struct page but with PG_head
> > flag set. I will start an investigation and a test.
>
> What are you thinking?
>
> static inline struct page *compound_head(struct page *page)
> {
> unsigned long head = READ_ONCE(page->compound_head);
>
> if (unlikely(head & 1))
> return (struct page *) (head - 1);
> + if (unlikely(page->flags & PG_head))
> + return (struct page *)(page[1]->compound_head - 1)
Yeah, I think so too. Maybe adding an align check is better.
+ if ((test_bit(PG_head, &page->flags) &&
+ IS_ALIGNED((unsigned long)page, PAGE_SIZE))
> return page;
> }
>
> ... because if it's that, there are code paths which also just test
> PageHead, and so we'd actually need to change PageHead to be something
> like:
Yeah, I also think that rework compound_head() and PageHead() is enough.
Thanks.
>
> static inline bool PageHead(struct page *page)
> {
> return (page->flags & PG_head) &&
> (page[1]->compound_head == (unsigned long)page + 1);
> }
>
> I'm not sure if that's worth doing -- there may be other things I
> haven't thought of.
--
Yours,
Muchun
Powered by blists - more mailing lists