Commit dcc1be11 authored by Lorenzo Stoakes's avatar Lorenzo Stoakes Committed by Andrew Morton

mm: prefer xxx_page() alloc/free functions for order-0 pages

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.comSigned-off-by: default avatarLorenzo Stoakes <lstoakes@gmail.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
Acked-by: default avatarMel 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 0a54864f
...@@ -123,11 +123,11 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) ...@@ -123,11 +123,11 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
if (mm == &init_mm) if (mm == &init_mm)
gfp = GFP_PGTABLE_KERNEL; gfp = GFP_PGTABLE_KERNEL;
page = alloc_pages(gfp, 0); page = alloc_page(gfp);
if (!page) if (!page)
return NULL; return NULL;
if (!pgtable_pmd_page_ctor(page)) { if (!pgtable_pmd_page_ctor(page)) {
__free_pages(page, 0); __free_page(page);
return NULL; return NULL;
} }
return (pmd_t *)page_address(page); return (pmd_t *)page_address(page);
......
...@@ -1048,7 +1048,7 @@ static void __init destroy_args(struct pgtable_debug_args *args) ...@@ -1048,7 +1048,7 @@ static void __init destroy_args(struct pgtable_debug_args *args)
if (args->pte_pfn != ULONG_MAX) { if (args->pte_pfn != ULONG_MAX) {
page = pfn_to_page(args->pte_pfn); page = pfn_to_page(args->pte_pfn);
__free_pages(page, 0); __free_page(page);
args->pte_pfn = ULONG_MAX; args->pte_pfn = ULONG_MAX;
} }
...@@ -1290,7 +1290,7 @@ static int __init init_args(struct pgtable_debug_args *args) ...@@ -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) if (page)
args->pte_pfn = page_to_pfn(page); args->pte_pfn = page_to_pfn(page);
......
...@@ -400,7 +400,7 @@ static int alloc_vmemmap_page_list(unsigned long start, unsigned long end, ...@@ -400,7 +400,7 @@ static int alloc_vmemmap_page_list(unsigned long start, unsigned long end,
return 0; return 0;
out: out:
list_for_each_entry_safe(page, next, list, lru) list_for_each_entry_safe(page, next, list, lru)
__free_pages(page, 0); __free_page(page);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -32,7 +32,7 @@ static bool tlb_next_batch(struct mmu_gather *tlb) ...@@ -32,7 +32,7 @@ static bool tlb_next_batch(struct mmu_gather *tlb)
if (tlb->batch_count == MAX_GATHER_BATCH_COUNT) if (tlb->batch_count == MAX_GATHER_BATCH_COUNT)
return false; return false;
batch = (void *)__get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0); batch = (void *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
if (!batch) if (!batch)
return false; return false;
......
...@@ -5558,7 +5558,7 @@ EXPORT_SYMBOL(__get_free_pages); ...@@ -5558,7 +5558,7 @@ EXPORT_SYMBOL(__get_free_pages);
unsigned long get_zeroed_page(gfp_t gfp_mask) 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); EXPORT_SYMBOL(get_zeroed_page);
......
...@@ -2739,7 +2739,7 @@ void vfree(const void *addr) ...@@ -2739,7 +2739,7 @@ void vfree(const void *addr)
* High-order allocs for huge vmallocs are split, so * High-order allocs for huge vmallocs are split, so
* can be freed as an array of order-0 allocations * can be freed as an array of order-0 allocations
*/ */
__free_pages(page, 0); __free_page(page);
cond_resched(); cond_resched();
} }
atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages); atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment