linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: page_alloc: Simplify __free_pages_ok()
@ 2023-12-16  3:05 Yajun Deng
  2023-12-16  3:23 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Yajun Deng @ 2023-12-16  3:05 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Yajun Deng

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

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 mm/page_alloc.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2f646773a934..f46af8616cac 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1262,7 +1262,6 @@ static void free_one_page(struct zone *zone,
 static void __free_pages_ok(struct page *page, unsigned int order,
 			    fpi_t fpi_flags)
 {
-	unsigned long flags;
 	int migratetype;
 	unsigned long pfn = page_to_pfn(page);
 	struct zone *zone = page_zone(page);
@@ -1277,13 +1276,7 @@ static void __free_pages_ok(struct page *page, unsigned int order,
 	 */
 	migratetype = get_pfnblock_migratetype(page, pfn);
 
-	spin_lock_irqsave(&zone->lock, 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);
+	free_one_page(zone, page, pfn, order, migratetype, fpi_flags);
 
 	__count_vm_events(PGFREE, 1 << order);
 }
-- 
2.25.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: page_alloc: Simplify __free_pages_ok()
  2023-12-16  3:05 [PATCH] mm: page_alloc: Simplify __free_pages_ok() Yajun Deng
@ 2023-12-16  3:23 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2023-12-16  3:23 UTC (permalink / raw)
  To: Yajun Deng; +Cc: akpm, linux-mm, linux-kernel

On Sat, Dec 16, 2023 at 11:05:03AM +0800, Yajun Deng wrote:
> There is redundant code in __free_pages_ok(). Use free_one_page()
> simplify it.
> 
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-16  3:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-16  3:05 [PATCH] mm: page_alloc: Simplify __free_pages_ok() Yajun Deng
2023-12-16  3:23 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox