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/[email protected] Signed-off-by: Dave Hansen <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Acked-by: David Hildenbrand <[email protected]> Acked-by: Mike Rapoport (Microsoft) <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Betkov <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jann Horn <[email protected]> Cc: Jean-Philippe Brucker <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Robin Murohy <[email protected]> Cc: Thomas Gleinxer <[email protected]> Cc: "Uladzislau Rezki (Sony)" <[email protected]> Cc: Vasant Hegde <[email protected]> Cc: Vinicius Costa Gomes <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yi Lai <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
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)