[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201029132621.GA2842@linux>
Date: Thu, 29 Oct 2020 14:26:27 +0100
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, mchehab+huawei@...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,
duanxiongchun@...edance.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2 04/19] mm/hugetlb: Introduce nr_free_vmemmap_pages in
the struct hstate
On Mon, Oct 26, 2020 at 10:50:59PM +0800, Muchun Song wrote:
> If the size of hugetlb page is 2MB, we need 512 struct page structures
> (8 pages) to be associated with it. As far as I know, we only use the
> first 4 struct page structures.
As Mike pointed out, better describe what those "4" mean.
> For tail pages, the value of compound_dtor is the same. So we can reuse
I might be missing something, but HUGETLB_PAGE_DTOR is only set on the
first tail, right?
> +#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
> +#define RESERVE_VMEMMAP_NR 2U
Although you can get that from the changelog, maybe a brief comment explaining
why RESERVE_VMEMMAP_NR == 2.
> +
> +static inline unsigned int nr_free_vmemmap(struct hstate *h)
> +{
> + return h->nr_free_vmemmap_pages;
> +}
Better add this in the patch that is used?
> + if (vmemmap_pages > RESERVE_VMEMMAP_NR)
> + h->nr_free_vmemmap_pages = vmemmap_pages - RESERVE_VMEMMAP_NR;
> + else
> + h->nr_free_vmemmap_pages = 0;
Can we really have an scenario where we end up with vmemmap_pages < RESERVE_VMEMMAP_NR?
> +
> + pr_info("HugeTLB: can free %d vmemmap pages for %s\n",
> + h->nr_free_vmemmap_pages, h->name);
I do not think this is useful unless debugging situations, so I would either
scratch that or make it pr_debug.
--
Oscar Salvador
SUSE L3
Powered by blists - more mailing lists