Commit 250ae189 authored by Yajun Deng's avatar Yajun Deng Committed by Andrew Morton

mm: page_alloc: simplify __free_pages_ok()

There is redundant code in __free_pages_ok(). Use free_one_page()
simplify it.

Link: https://lkml.kernel.org/r/20231216030503.2126130-1-yajun.deng@linux.devSigned-off-by: default avatarYajun Deng <yajun.deng@linux.dev>
Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 7e552dcd
...@@ -1255,7 +1255,6 @@ static void free_one_page(struct zone *zone, ...@@ -1255,7 +1255,6 @@ static void free_one_page(struct zone *zone,
static void __free_pages_ok(struct page *page, unsigned int order, static void __free_pages_ok(struct page *page, unsigned int order,
fpi_t fpi_flags) fpi_t fpi_flags)
{ {
unsigned long flags;
int migratetype; int migratetype;
unsigned long pfn = page_to_pfn(page); unsigned long pfn = page_to_pfn(page);
struct zone *zone = page_zone(page); struct zone *zone = page_zone(page);
...@@ -1270,13 +1269,7 @@ static void __free_pages_ok(struct page *page, unsigned int order, ...@@ -1270,13 +1269,7 @@ static void __free_pages_ok(struct page *page, unsigned int order,
*/ */
migratetype = get_pfnblock_migratetype(page, pfn); migratetype = get_pfnblock_migratetype(page, pfn);
spin_lock_irqsave(&zone->lock, flags); free_one_page(zone, page, pfn, order, migratetype, fpi_flags);
if (unlikely(has_isolate_pageblock(zone) ||
is_migrate_isolate(migratetype))) {
migratetype = get_pfnblock_migratetype(page, pfn);
}
__free_one_page(page, pfn, zone, order, migratetype, fpi_flags);
spin_unlock_irqrestore(&zone->lock, flags);
__count_vm_events(PGFREE, 1 << order); __count_vm_events(PGFREE, 1 << order);
} }
......
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