Re: [External] Re: [PATCH v2 04/19] mm/hugetlb: Introduce nr_free_vmemmap_pages in the struct hstate
From: Muchun Song
Date: Thu Oct 29 2020 - 09:42:35 EST
On Thu, Oct 29, 2020 at 9:26 PM Oscar Salvador <osalvador@xxxxxxx> wrote:
>
> 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.
Yeah, thanks.
>
> > 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?
Sorry for confusion. Here I mean the `compound_head` is the same.
>
> > +#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?
OK, I will do it. thanks.
>
> > + 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?
I think that this is impossible. On the safe side, I do this comparison.
Do you think we should remove this comparison? Is that right?
>
> > +
> > + 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.
Thanks for your suggestions.
>
>
> --
> Oscar Salvador
> SUSE L3
--
Yours,
Muchun