Skip to content

Commit c32806b

Browse files
hansendcgregkh
authored andcommitted
mm: introduce pure page table freeing function
commit 0189429 upstream. 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. Link: https://lkml.kernel.org/r/20251022082635.2462433-6-baolu.lu@linux.intel.com Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Acked-by: David Hildenbrand <david@redhat.com> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: Alistair Popple <apopple@nvidia.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Betkov <bp@alien8.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jann Horn <jannh@google.com> Cc: Jean-Philippe Brucker <jean-philippe@linaro.org> Cc: Joerg Roedel <joro@8bytes.org> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Robin Murohy <robin.murphy@arm.com> Cc: Thomas Gleinxer <tglx@linutronix.de> Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com> Cc: Vasant Hegde <vasant.hegde@amd.com> Cc: Vinicius Costa Gomes <vinicius.gomes@intel.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Will Deacon <will@kernel.org> Cc: Yi Lai <yi1.lai@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b63c129 commit c32806b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

include/linux/mm.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,6 +3031,13 @@ static inline struct ptdesc *pagetable_alloc_noprof(gfp_t gfp, unsigned int orde
30313031
}
30323032
#define pagetable_alloc(...) alloc_hooks(pagetable_alloc_noprof(__VA_ARGS__))
30333033

3034+
static inline void __pagetable_free(struct ptdesc *pt)
3035+
{
3036+
struct page *page = ptdesc_page(pt);
3037+
3038+
__free_pages(page, compound_order(page));
3039+
}
3040+
30343041
/**
30353042
* pagetable_free - Free pagetables
30363043
* @pt: The page table descriptor
@@ -3040,12 +3047,10 @@ static inline struct ptdesc *pagetable_alloc_noprof(gfp_t gfp, unsigned int orde
30403047
*/
30413048
static inline void pagetable_free(struct ptdesc *pt)
30423049
{
3043-
struct page *page = ptdesc_page(pt);
3044-
30453050
if (ptdesc_test_kernel(pt))
30463051
ptdesc_clear_kernel(pt);
30473052

3048-
__free_pages(page, compound_order(page));
3053+
__pagetable_free(pt);
30493054
}
30503055

30513056
#if defined(CONFIG_SPLIT_PTE_PTLOCKS)

0 commit comments

Comments
 (0)