Re: [PATCH v2] kpageflags: respect folio head-page flag placement

From: Gregory Price
Date: Mon Oct 30 2023 - 19:41:34 EST


On Mon, Oct 30, 2023 at 11:22:18PM +0000, Matthew Wilcox wrote:
> On Mon, Oct 30, 2023 at 02:00:05PM -0400, Gregory Price wrote:
> > kpageflags reads page-flags directly from the page, even when the
> > respective flag is only updated on the headpage of a folio.
> >
> > Update bitchecks to use PAGEFLAG() interfaces to check folio for the
> > referenced, dirty, lru, active, and unevictable bits.
>
> But uptodate, writeback and reclaim (amongst others) are also defined
> only on the head page.
>

Ah yes i was only looking at the things defined w/ PAGEFLAG defines in
page-flags.h. I'll give it full once over can collect them all, my bad.

(also i forgot to update my commit message)

Quick question here since i have your attention: any recommendation on
what to do for ONLY_HEAD flags? If the provided page is not the head,
should the flag report 0... or whatever the head says?

> > u |= kpf_copy_bit(k, KPF_UPTODATE, PG_uptodate);
> > u |= kpf_copy_bit(k, KPF_WRITEBACK, PG_writeback);
> >
> > u |= kpf_copy_bit(k, KPF_RECLAIM, PG_reclaim);
> >
> > if (PageSwapCache(page))
> > u |= 1 << KPF_SWAPCACHE;
> > u |= kpf_copy_bit(k, KPF_SWAPBACKED, PG_swapbacked);
> >
> > u |= kpf_copy_bit(k, KPF_MLOCKED, PG_mlocked);
>