Re: [PATCH v3 0/5] Keep tail page private zero at free and folio split time
From: Andrew Morton
Date: Thu Jul 09 2026 - 14:46:53 EST
On Thu, 09 Jul 2026 14:06:00 -0400 Zi Yan <ziy@xxxxxxxxxx> wrote:
> Hi all,
>
> This patchset makes sure tail_page->private is zero before compound or
> high-order pages are returned to the allocator. It also checks tail pages
> that become new folio heads during large folio split, before their private
> fields are used by new folios.
Updated, thanks.
> Changes in v3:
> 1. replaced "it" with "a DEBUG_VM check" in Patch 3 commit message
> 2. moved tail_page->private bad_page() code up to the existing
> is_check_pages_enabled() block in Patch 4.
> - Link to v2: https://lore.kernel.org/r/20260703-keep-subpage-private-zero-at-free-v2-0-2970fe777dd6@xxxxxxxxxx
Here's how v3 altered mm.git:
mm/page_alloc.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--- a/mm/page_alloc.c~b
+++ a/mm/page_alloc.c
@@ -1386,13 +1386,14 @@ static __always_inline bool __free_pages
bad++;
continue;
}
+
+ if (tail_page->private) {
+ bad_page(tail_page, "nonzero private");
+ bad++;
+ continue;
+ }
}
tail_page->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP;
- if (is_check_pages_enabled() && tail_page->private) {
- bad_page(tail_page, "nonzero private");
- bad++;
- continue;
- }
}
}
if (folio_test_anon(folio)) {
_