Re: [PATCH v2 02/15] mm/hugetlb: compare against persistent count when freeing lowmem folios
From: Oscar Salvador (SUSE)
Date: Tue Nov 17 2026 - 05:12:01 EST
On Mon, Nov 16, 2026 at 07:29:23PM +0100, David Hildenbrand (Arm) wrote:
> try_to_free_low() gets a target number of persistent folios, but
> compares it with "nr_huge_pages", which includes surplus folios. As a
> result, it can free lowmem folios below that target.
>
> For example, with two persistent folios and one surplus folio, a target
> of two can still end up freeing one persistent folio.
>
> Compare against persistent_huge_pages() instead. Convert the macro to a
> helper function and place it before try_to_free_low().
>
> Fixes: 7893d1d505d5 ("hugetlb: Try to grow hugetlb pool for MAP_PRIVATE mappings")
> Cc: stable@xxxxxxxxxx
> Acked-by: Muchun Song <muchun.song@xxxxxxxxx>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
Acked-by: Oscar Salvador (SUSE) <osalvador@xxxxxxxxxx>
--
Oscar Salvador
SUSE Labs