[PATCH 4/4] mm/page_alloc: no need to ClearPageReserved on giving page to buddy system

Wei Yang
2024-06-29T01:33:52Z

Function __free_pages_core() is only used in the following two cases to
put page to buddy system:

* free bootmem
* free hot-add memory

After the above cleanup, there is no case to free page with PG_reserved
set. Let's remove the clear operation.

The page initialization time shows 6.5% faster with a 6G qemu virtual
machine.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: David Hildenbrand <david@redhat.com>
CC: Mike Rapoport (IBM) <rppt@kernel.org>
---
mm/page_alloc.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 51a47db375b6..bc7316744a34 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1232,10 +1232,8 @@ void __meminit __free_pages_core(struct page *page, unsigned int order)
prefetchw(p);
for (loop = 0; loop < (nr_pages - 1); loop++, p++) {
prefetchw(p + 1);
- __ClearPageReserved(p);
set_page_count(p, 0);
}
- __ClearPageReserved(p);
set_page_count(p, 0);

atomic_long_add(nr_pages, &page_zone(page)->managed_pages);
--
2.34.1