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