[PATCH v2 1/4] mm: fix missing page-table destructor in pagetable_free()

Dave Hansen dave.hansen at intel.com
Mon Oct 12 07:06:28 PDT 2026


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 at intel.com>



More information about the linux-arm-kernel mailing list