[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtUrYismcOai6zsx+X+Mixy=uUtrWU0CQJLxJn8kcfB+8A@mail.gmail.com>
Date: Mon, 10 May 2021 20:19:47 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Oscar Salvador <osalvador@...e.de>
Cc: Jonathan Corbet <corbet@....net>,
Mike Kravetz <mike.kravetz@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, bp@...en8.de,
X86 ML <x86@...nel.org>, hpa@...or.com,
dave.hansen@...ux.intel.com, luto@...nel.org,
Peter Zijlstra <peterz@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>, paulmck@...nel.org,
pawan.kumar.gupta@...ux.intel.com,
Randy Dunlap <rdunlap@...radead.org>, oneukum@...e.com,
anshuman.khandual@....com, jroedel@...e.de,
Mina Almasry <almasrymina@...gle.com>,
David Rientjes <rientjes@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
Michal Hocko <mhocko@...e.com>,
"Song Bao Hua (Barry Song)" <song.bao.hua@...ilicon.com>,
David Hildenbrand <david@...hat.com>,
HORIGUCHI NAOYA(堀口 直也)
<naoya.horiguchi@....com>,
Joao Martins <joao.m.martins@...cle.com>,
Xiongchun duan <duanxiongchun@...edance.com>,
fam.zheng@...edance.com, zhengqi.arch@...edance.com,
linux-doc@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [External] Re: [PATCH v23 6/9] mm: hugetlb: alloc the vmemmap
pages associated with each HugeTLB page
On Mon, May 10, 2021 at 6:45 PM Oscar Salvador <osalvador@...e.de> wrote:
>
> On Mon, May 10, 2021 at 11:00:24AM +0800, Muchun Song wrote:
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -1376,6 +1376,39 @@ static void remove_hugetlb_page(struct hstate *h, struct page *page,
> > h->nr_huge_pages_node[nid]--;
> > }
> >
> > +static void add_hugetlb_page(struct hstate *h, struct page *page,
> > + bool adjust_surplus)
> > +{
> > + int zeroed;
> > + int nid = page_to_nid(page);
> > +
> > + VM_BUG_ON_PAGE(!HPageVmemmapOptimized(page), page);
> > +
> > + lockdep_assert_held(&hugetlb_lock);
> > +
> > + INIT_LIST_HEAD(&page->lru);
> > + h->nr_huge_pages++;
> > + h->nr_huge_pages_node[nid]++;
> > +
> > + if (adjust_surplus) {
> > + h->surplus_huge_pages++;
> > + h->surplus_huge_pages_node[nid]++;
> > + }
> > +
> > + set_compound_page_dtor(page, HUGETLB_PAGE_DTOR);
> > + set_page_private(page, 0);
>
> I think this has already been discused, so sorry about this.
>
> The only reason to need the set_page_private() is because of the dissolving
> function right? add_hugetlb_page() can only get reached via free_huge_page(),
> or dissolve_free_huge_page, and while the former clears the flags, the latter
> it does not.
Not exactly right. free_huge_page() does not clear HPageTemporary
if the page is temporarily allocated when freeing. You are right that
dissolve_free_huge_page() does not clear HPageFreed.
>
> I think this function would benefit from some renaming. add_hugetlb_page() gives
> me no hint of what is this about, although I can figure it out reading the code.
Because I think it is the reverse operation of remove_hugetlb_page,
I named it add_hugetlb_page. Do you have any suggestions for
renaming?
Thanks.
>
> With that: Reviewed-by: Oscar Salvador <osalvador@...e.de>
>
>
>
>
> --
> Oscar Salvador
> SUSE L3
Powered by blists - more mailing lists