[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aOypSS-Pk-LppKhV@kernel.org>
Date: Mon, 13 Oct 2025 10:24:57 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Kevin Tian <kevin.tian@...el.com>, Jason Gunthorpe <jgg@...dia.com>,
Jann Horn <jannh@...gle.com>, Vasant Hegde <vasant.hegde@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...el.com>,
Alistair Popple <apopple@...dia.com>,
Peter Zijlstra <peterz@...radead.org>,
Uladzislau Rezki <urezki@...il.com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Andy Lutomirski <luto@...nel.org>, Yi Lai <yi1.lai@...el.com>,
iommu@...ts.linux.dev, security@...nel.org, x86@...nel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH v5 4/8] mm: Introduce pure page table freeing function
On Fri, Sep 19, 2025 at 01:40:02PM +0800, Lu Baolu wrote:
> From: Dave Hansen <dave.hansen@...ux.intel.com>
>
> The pages used for ptdescs are currently freed back to the allocator
> in a single location. They will shortly be freed from a second
> location.
>
> Create a simple helper that just frees them back to the allocator.
>
> Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
> Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
> Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
> ---
> include/linux/mm.h | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index f3db3a5ebefe..668d519edc0f 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2884,6 +2884,13 @@ static inline struct ptdesc *pagetable_alloc_noprof(gfp_t gfp, unsigned int orde
> }
> #define pagetable_alloc(...) alloc_hooks(pagetable_alloc_noprof(__VA_ARGS__))
>
> +static inline void __pagetable_free(struct ptdesc *pt)
> +{
> + struct page *page = ptdesc_page(pt);
> +
> + __free_pages(page, compound_order(page));
> +}
> +
> /**
> * pagetable_free - Free pagetables
> * @pt: The page table descriptor
> @@ -2893,12 +2900,10 @@ static inline struct ptdesc *pagetable_alloc_noprof(gfp_t gfp, unsigned int orde
> */
> static inline void pagetable_free(struct ptdesc *pt)
> {
> - struct page *page = ptdesc_page(pt);
> -
> if (ptdesc_test_kernel(pt))
> ptdesc_clear_kernel(pt);
>
> - __free_pages(page, compound_order(page));
> + __pagetable_free(pt);
> }
>
> #if defined(CONFIG_SPLIT_PTE_PTLOCKS)
> --
> 2.43.0
>
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists