[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210510104524.GD22664@linux>
Date: Mon, 10 May 2021 12:45:24 +0200
From: Oscar Salvador <osalvador@...e.de>
To: Muchun Song <songmuchun@...edance.com>
Cc: corbet@....net, mike.kravetz@...cle.com, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, x86@...nel.org, hpa@...or.com,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
paulmck@...nel.org, pawan.kumar.gupta@...ux.intel.com,
rdunlap@...radead.org, oneukum@...e.com, anshuman.khandual@....com,
jroedel@...e.de, almasrymina@...gle.com, rientjes@...gle.com,
willy@...radead.org, mhocko@...e.com, song.bao.hua@...ilicon.com,
david@...hat.com, naoya.horiguchi@....com,
joao.m.martins@...cle.com, duanxiongchun@...edance.com,
fam.zheng@...edance.com, zhengqi.arch@...edance.com,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v23 6/9] mm: hugetlb: alloc the vmemmap pages associated
with each HugeTLB page
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.
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.
With that: Reviewed-by: Oscar Salvador <osalvador@...e.de>
--
Oscar Salvador
SUSE L3
Powered by blists - more mailing lists