Re: [PATCH v7 1/3] mm: preserve PG_dropbehind flag during folio split
From: Jan Kara
Date: Tue May 12 2026 - 10:53:21 EST
On Mon 11-05-26 07:58:27, Jeff Layton wrote:
> __split_folio_to_order() copies page flags from the original folio to
> newly created sub-folios using an explicit allowlist, but PG_dropbehind
> is not included. When a large folio with PG_dropbehind set is split,
> only the head sub-folio retains the flag; all tail sub-folios silently
> lose it and will not be reclaimed eagerly after writeback completes.
>
> Add PG_dropbehind to the flag copy mask so that the drop-behind hint
> is preserved across folio splits.
>
> Fixes: a323281cdfec ("mm: add PG_dropbehind folio flag")
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
I'm not really very knowledgeable in this code but the change looks good to
me. Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
> ---
> mm/huge_memory.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 970e077019b7..e01917b14d1a 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -3642,6 +3642,7 @@ static void __split_folio_to_order(struct folio *folio, int old_order,
> (1L << PG_arch_3) |
> #endif
> (1L << PG_dirty) |
> + (1L << PG_dropbehind) |
> LRU_GEN_MASK | LRU_REFS_MASK));
>
> if (handle_hwpoison &&
>
> --
> 2.54.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR