On 5/19/26 08:10, Juhyung Park wrote:
> #endif
> } else {
> - pagetable_free(page_ptdesc(page));
> + /*
> + * Use __free_pages() to honor @order: vmemmap PMD leaves
> + * freed here are not compound pages, so pagetable_free()
> + * would lose leak 511 of 512 pages per 2 MB chunk.
> + */
> + __free_pages(page, order);
> }
> }
I find myself really wondering how much of this came from a human and
how much from the LLM. Could you share that with us?
We're trying to get _away_ from using the 'struct page' APIs on page
tables. This goes backwards. Worst case, do:
/* vmemmap PMD leaves are not compound pages */
for (i = 0; i < 1<<order; i++)
pagetable_free(page_ptdesc(&page[i]));
Right?
Even better would be to *make* these compound pages.
Even better than that would be to use some 'struct ptdesc' space to
explicitly store the order, just like compound pages. But that's
probably not trivial and probably not great for a bug fix.