Skip to contentSkip to conversation

arch/x86: Do not explicitly clear Reserved flag in free_pagetable

PATCH Applied Oscar Salvador 2 participants 2 messages May 27, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/x86: Do not explicitly clear Reserved flag in free_pagetable

In free_pagetable() we use the non-atomic version for clearing the PageReserved bit from the page.
free_pagetable() will either call free_reserved_page() or put_page_bootmem(), which will eventually end up calling free_serverd_page(), and in there we already clear the PageReserved flag.

---
This has been like this since commit ae9aae9eda2d ("memory-hotplug: common APIs to support page tables hot-remove"), so I might be missing something obvious, but I cannot explain why we would need that __ClearPageReserved upfront, when free_reserved_pages() already does that for us.

---
 arch/x86/mm/init_64.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/mm/init_64.c +0 -2
index 7e177856ee4f..9f4778c2cf9f 100644
@@ -980,8 +980,6 @@ static void __meminit free_pagetable(struct page *page, int order)
 
 	/* bootmem page has reserved flag */
 	if (PageReserved(page)) {
-		__ClearPageReserved(page);
-
 		magic = page->index;
 		if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) {
 			while (nr_pages--)
Signature · 1 line
2.45.1
Acked-by on v1 1/1
#1 lore raw

Am 27.05.24 um 06:45 schrieb Oscar Salvador:

Quoted 6 lines

In free_pagetable() we use the non-atomic version for clearing the PageReserved bit from the page.
free_pagetable() will either call free_reserved_page() or put_page_bootmem(), which will eventually end up calling free_serverd_page(), and in there we already clear the PageReserved flag.

Quoted 6 lines

---
This has been like this since commit ae9aae9eda2d ("memory-hotplug: common APIs to support page tables hot-remove"), so I might be missing something obvious, but I cannot explain why we would need that __ClearPageReserved upfront, when free_reserved_pages() already does that for us.

Especially, we only call it on the first page (in case we'd have order>0).

Signature · 3 lines
Thanks,

David / dhildenb