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

From: Rik van Riel
Date: Wed Oct 25 2023 - 21:35:16 EST


On Wed, 2023-10-25 at 16:12 -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;
> +
>         u |= kpf_copy_bit(k, KPF_UPTODATE,      PG_uptodate);
>         u |= kpf_copy_bit(k, KPF_WRITEBACK,     PG_writeback);
>  
> -       u |= kpf_copy_bit(k, KPF_LRU,           PG_lru);
> -       u |= kpf_copy_bit(k, KPF_REFERENCED,    PG_referenced);
> -       u |= kpf_copy_bit(k, KPF_ACTIVE,        PG_active);
> +       if (PageLRU(page))
> +               u |= 1 << KPF_LRU;
> +
> +       if (PageReferenced(page))
> +               u |= 1 << KPF_REFERENCED;
> +
> +       if (PageActive(page))
> +               u |= 1 << KPF_ACTIVE;
> +
>         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);
>

Aren't PG_locked, PG_reclaim, and PG_swapbacked also maintained only on
the folio/head?

Would it make sense to convert those over as well?

--
All Rights Reversed.