Skip to contentSkip to conversation

stackdepot-stop-preallocating-after-the-final-pool.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Oct 24 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: stackdepot: stop preallocating after the final pool
has been removed from the -mm tree. Its filename was
stackdepot-stop-preallocating-after-the-final-pool.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Caleb Kan <[email protected]>
Subject: stackdepot: stop preallocating after the final pool
Date: Thu, 22 Oct 2026 09:33:30 +0100

depot_init_pool() decides whether another pool is needed before it increments pools_num. When it registers the last allowed pool, pools_num is still one below stack_max_pools, so the existing comparison clears new_pool.

With new_pool cleared, stack_depot_save_flags() can allocate another order-2 pool after a lookup miss. depot_keep_new_pool() retains its pointer in the global new_pool, so the allocation is not lost. However, pools_num has already reached stack_max_pools, and depot_init_pool() rejects every attempt to register the pool. It remains allocated and unusable until reboot. The non-NULL pointer prevents later saves from allocating more spare pools.

Account for the pool being registered in the limit check so registering the final pool installs STACK_DEPOT_POISON and prevents the extra allocation.

Fixes 31639fd6cebd ("stackdepot: use variable size records for non-evictable entries")
Cc Andrey Konovalov <[email protected]>
Cc Mikhail Gavrilov <[email protected]>
Cc Caleb Kan <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 lib/stackdepot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/stackdepot.c renamed from lib/stackdepot.c~stackdepot-stop-preallocating-after-the-final-pool +1 -1
@@ -323,7 +323,7 @@ static bool depot_init_pool(void **preal
 	 * NULL; do not reset to NULL if we have reached the maximum number of
 	 * pools.
 	 */
-	if (pools_num < stack_max_pools)
+	if (pools_num + 1 < stack_max_pools)
 		WRITE_ONCE(new_pool, NULL);
 	else
 		WRITE_ONCE(new_pool, STACK_DEPOT_POISON);

_

Patches currently in -mm which might be from [email protected] are