Re: [PATCH v5 3/4] x86/vmemmap: Handle unpopulated sub-pmd ranges

From: Dave Hansen
Date: Tue Mar 09 2021 - 13:40:22 EST


On 3/9/21 9:41 AM, Oscar Salvador wrote:
> When sizeof(struct page) is not a power of 2, sections do not span
> a PMD anymore and so when populating them some parts of the PMD will
> remain unused.
> Because of this, PMDs will be left behind when depopulating sections
> since remove_pmd_table() thinks that those unused parts are still in
> use.
>
> Fix this by marking the unused parts with PAGE_UNUSED, so memchr_inv()
> will do the right thing and will let us free the PMD when the last user
> of it is gone.
>
> This patch is based on a similar patch by David Hildenbrand:
>
> https://lore.kernel.org/linux-mm/20200722094558.9828-9-david@xxxxxxxxxx/

Looks good now. It's much easier to read without the optimization.

Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>