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

From: Matthew Wilcox
Date: Thu Oct 26 2023 - 16:00:27 EST


On Wed, Oct 25, 2023 at 04:12:37PM -0400, Gregory Price wrote:
> +++ b/fs/proc/page.c
> @@ -188,20 +188,31 @@ u64 stable_page_flags(struct page *page)
> u |= 1 << KPF_SLAB;
>
> u |= kpf_copy_bit(k, KPF_ERROR, PG_error);
> - u |= kpf_copy_bit(k, KPF_DIRTY, PG_dirty);
> +
> + if (PageDirty(page))
> + u |= 1 << KPF_DIRTY;

This is not the way to do it.

At the beginning of the function, add:

struct folio *folio = page_folio(page);

Then use folio_test_XXX istead of PageXXX().