summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDeyan Wang <wonder_rock@126.com>2022-12-01 21:50:45 +0800
committerAndrew Morton <akpm@linux-foundation.org>2022-12-11 18:12:17 -0800
commitac4b2901a112e4dcee1455c96d89ef83cc7aa545 (patch)
treeae3fe734e69c69bb95bac4dbac2d361a31462be4 /mm
parent480017957d6380d3336a8e80ad90f70415bb86f7 (diff)
downloadlinux-ac4b2901a112e4dcee1455c96d89ef83cc7aa545.tar.bz2
mm/page_alloc: update comments in __free_pages_ok()
Add a comment to explain why we call get_pfnblock_migratetype() twice in __free_pages_ok(). Link: https://lkml.kernel.org/r/20221201135045.31663-1-wonder_rock@126.com Signed-off-by: Deyan Wang <wonder_rock@126.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5ab9dd29ef7e..0745aedebb37 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1702,6 +1702,11 @@ static void __free_pages_ok(struct page *page, unsigned int order,
if (!free_pages_prepare(page, order, true, fpi_flags))
return;
+ /*
+ * Calling get_pfnblock_migratetype() without spin_lock_irqsave() here
+ * is used to avoid calling get_pfnblock_migratetype() under the lock.
+ * This will reduce the lock holding time.
+ */
migratetype = get_pfnblock_migratetype(page, pfn);
spin_lock_irqsave(&zone->lock, flags);