Re: [PATCH v2 1/4] mm: fix missing page-table destructor in pagetable_free()
From: Dave Hansen
Date: Mon Oct 12 2026 - 10:42:40 EST
On 10/10/26 04:24, Muchun Song wrote:
> +/**
> + * pagetable_free - Free pagetables
> + * @pt: The page table descriptor
> + *
> + * pagetable_free frees the memory of all page tables described by a page
> + * table descriptor and the memory for the descriptor itself.
> + */
> +static inline void pagetable_free(struct ptdesc *pt)
> +{
> + if (PageTable(ptdesc_page(pt)))
> + pagetable_dtor(pt);
> +
> + if (ptdesc_test_kernel(pt)) {
> + ptdesc_clear_kernel(pt);
> + pagetable_free_kernel(pt);
> + } else {
> + __pagetable_free(pt);
> + }
> +}
This is an improvement on the last one, especially the changelog, thanks!
There's also some room here to comment why this needs separate user and
kernel page table handling and why some ptdesc have dtors and others
don't. But that's another patch.
Acked-by: Dave Hansen <dave.hansen@xxxxxxxxx>