Re: [PATCH v1 1/3] mm: Allow deferred splitting of arbitrary large anon folios

From: Matthew Wilcox
Date: Mon Jul 17 2023 - 12:17:32 EST


On Mon, Jul 17, 2023 at 04:54:58PM +0100, Matthew Wilcox wrote:
> Those are page->flags and page->compound_head for the third page in
> the folio. They don't really need a name; nothing refers to them,
> but it's important that space not be reused ;-)
>
> This is slightly different from _flags_1; we do have some flags which
> reuse the bits (they're labelled as PF_SECOND). Right now, it's only
> PG_has_hwpoisoned, but we used to have PG_double_map. Others may arise.

Sorry, this was incomplete. We do still have per-page flags! HWPoison
is the obvious one, but PG_head is per-page (... think about it ...)
PG_anon_exclusive is actually per-page.

Most of the flags labelled as PF_ANY are mislabelled. PG_private and
PG_private2 are never set/cleared/tested on tail pages. PG_young and
PG_idle are only ever tested on the head page, but some code incorrectly
sets them on tail pages, where those bits are ignored. I tried to fix
that a while ago, but the patch was overlooked and I couldn't be bothered
to try all that hard. I have no clue about PG_vmemmap_self_hosted.
I think PG_isolated is probably never set on compound pages.
PG_owner_priv_1 is a disaster, as you might expect.