From: Lance Yang Date: Tue, 2 Jun 2026 04:34:53 +0000 (+0800) Subject: mm/thp: clear deferred split shrinker bits when queues drain X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25fcea21302237641ddd5816b5b2a20f368d1027;p=thirdparty%2Flinux.git mm/thp: clear deferred split shrinker bits when queues drain deferred_split_count() returns the raw list_lru count. When the per-memcg, per-node list is empty, that count is 0. That skips scanning, but it does not tell memcg reclaim that the shrinker is empty. shrink_slab_memcg() only clears the memcg shrinker bit when the count callback reports SHRINK_EMPTY. Return SHRINK_EMPTY for an empty deferred split list, so the bit can be cleared once the queue has drained. Link: https://lore.kernel.org/20260602043453.67597-1-lance.yang@linux.dev Signed-off-by: Lance Yang Reviewed-by: David Hildenbrand (Arm) Acked-by: Usama Arif Cc: Baolin Wang Cc: Barry Song Cc: Dave Chinner Cc: Dev Jain Cc: Johannes Weiner Cc: Kairui Song Cc: Kefeng Wang Cc: Liam R. Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Mikhail Zaslonko Cc: Muchun Song Cc: Nico Pache Cc: Roman Gushchin Cc: Ryan Roberts Cc: Shakeel Butt Cc: Vasily Gorbik Cc: Vlastimil Babka Cc: Zi Yan Signed-off-by: Andrew Morton --- diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 6927f66b2eb2..da851a5696d5 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4410,7 +4410,10 @@ void deferred_split_folio(struct folio *folio, bool partially_mapped) static unsigned long deferred_split_count(struct shrinker *shrink, struct shrink_control *sc) { - return list_lru_shrink_count(&deferred_split_lru, sc); + unsigned long count; + + count = list_lru_shrink_count(&deferred_split_lru, sc); + return count ?: SHRINK_EMPTY; } static bool thp_underused(struct folio *folio)