mm: prefer xxx_page() alloc/free functions for order-0 pages
authorLorenzo Stoakes <lstoakes@gmail.com>
Mon, 13 Mar 2023 12:27:14 +0000 (12:27 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 28 Mar 2023 23:20:16 +0000 (16:20 -0700)
Update instances of alloc_pages(..., 0), __get_free_pages(..., 0) and
__free_pages(..., 0) to use alloc_page(), __get_free_page() and
__free_page() respectively in core code.

Link: https://lkml.kernel.org/r/50c48ca4789f1da2a65795f2346f5ae3eff7d665.1678710232.git.lstoakes@gmail.com
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/asm-generic/pgalloc.h
mm/debug_vm_pgtable.c
mm/hugetlb_vmemmap.c
mm/mmu_gather.c
mm/page_alloc.c
mm/vmalloc.c

index 977bea16cf1bca953582e6dd547e94702548a1ca..a7cf825befaef0b4a4498056cabaa48d80f81277 100644 (file)
@@ -123,11 +123,11 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
 
        if (mm == &init_mm)
                gfp = GFP_PGTABLE_KERNEL;
-       page = alloc_pages(gfp, 0);
+       page = alloc_page(gfp);
        if (!page)
                return NULL;
        if (!pgtable_pmd_page_ctor(page)) {
-               __free_pages(page, 0);
+               __free_page(page);
                return NULL;
        }
        return (pmd_t *)page_address(page);
index 7887cc2b75bf234e2f5391f1faf0761c57f34bb4..4362021b1ce781710a6019de46388380d357ba96 100644 (file)
@@ -1048,7 +1048,7 @@ static void __init destroy_args(struct pgtable_debug_args *args)
 
        if (args->pte_pfn != ULONG_MAX) {
                page = pfn_to_page(args->pte_pfn);
-               __free_pages(page, 0);
+               __free_page(page);
 
                args->pte_pfn = ULONG_MAX;
        }
@@ -1290,7 +1290,7 @@ static int __init init_args(struct pgtable_debug_args *args)
                }
        }
 
-       page = alloc_pages(GFP_KERNEL, 0);
+       page = alloc_page(GFP_KERNEL);
        if (page)
                args->pte_pfn = page_to_pfn(page);
 
index a15cc56cf70a4f57eea27ca14502ef8eddec2d12..1198064f80eb99aea35ac8769b50e231f8cc8281 100644 (file)
@@ -400,7 +400,7 @@ static int alloc_vmemmap_page_list(unsigned long start, unsigned long end,
        return 0;
 out:
        list_for_each_entry_safe(page, next, list, lru)
-               __free_pages(page, 0);
+               __free_page(page);
        return -ENOMEM;
 }
 
index 2b93cf6ac9ae9cc06a035be4236edcfc7e97a554..ea9683e1293697b912ee5abfea1395c562d44234 100644 (file)
@@ -32,7 +32,7 @@ static bool tlb_next_batch(struct mmu_gather *tlb)
        if (tlb->batch_count == MAX_GATHER_BATCH_COUNT)
                return false;
 
-       batch = (void *)__get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0);
+       batch = (void *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
        if (!batch)
                return false;
 
index 3737f9d58f5f185c17876fc3a85c8908b7e3e92a..0936bde1d486f5955f5f1e3b2b1dad1c2373b090 100644 (file)
@@ -5558,7 +5558,7 @@ EXPORT_SYMBOL(__get_free_pages);
 
 unsigned long get_zeroed_page(gfp_t gfp_mask)
 {
-       return __get_free_pages(gfp_mask | __GFP_ZERO, 0);
+       return __get_free_page(gfp_mask | __GFP_ZERO);
 }
 EXPORT_SYMBOL(get_zeroed_page);
 
index 5e60e9792cbf641db353c1357d020a0aa51cbc73..978194dc2bb8872e01e31fd578d9c3cc1b952b37 100644 (file)
@@ -2739,7 +2739,7 @@ void vfree(const void *addr)
                 * High-order allocs for huge vmallocs are split, so
                 * can be freed as an array of order-0 allocations
                 */
-               __free_pages(page, 0);
+               __free_page(page);
                cond_resched();
        }
        atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages);