Re: [PATCH 2/2] x86/vmemmap: Handle unpopulated sub-pmd ranges

From: David Hildenbrand
Date: Tue Feb 02 2021 - 08:31:37 EST


@@ -1088,10 +1150,10 @@ remove_pud_table(pud_t *pud_start, unsigned long addr, unsigned long end,
pages++;
} else {
/* If here, we are freeing vmemmap pages. */
- memset((void *)addr, PAGE_INUSE, next - addr);
+ memset((void *)addr, PAGE_UNUSED, next - addr);
page_addr = page_address(pud_page(*pud));
- if (!memchr_inv(page_addr, PAGE_INUSE,
+ if (!memchr_inv(page_addr, PAGE_UNUSED,
PUD_SIZE)) {
free_pagetable(pud_page(*pud),
get_order(PUD_SIZE));

I'm sorry to bother you again, but isn't that dead code as well?

How do we ever end up using 1GB pages for the vmemmap? At least not via vmemmap_populate() - so I guess never? There are not many occurrences of "PUD_SIZE" in the file after all ...

I think we can simplify that code.

--
Thanks,

David / dhildenb