FAILED: patch "[PATCH] stackdepot: stop preallocating after the final pool" failed to apply to 6.12-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 8f56ea8e0706d92774603260779c7032f03ef3ac
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 8f56ea8e0706d92774603260779c7032f03ef3ac Mon Sep 17 00:00:00 2001
From: Caleb Kan <[email protected]>
Date: Thu, 22 Oct 2026 09:33:30 +0100
Subject: [PATCH] stackdepot: stop preallocating after the final pool
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.
--- lib/stackdepot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/stackdepot.c +1 -1
@@ -323,7 +323,7 @@ static bool depot_init_pool(void **prealloc)* 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 );
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 stackdepot: stop preallocating after the final pool
From: Caleb Kan <[email protected]>
[ Upstream commit 8f56ea8e0706d92774603260779c7032f03ef3ac ]
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.
--- lib/stackdepot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/stackdepot.c +1 -1
@@ -273,7 +273,7 @@ static bool depot_init_pool(void **prealloc)* NULL; do not reset to NULL if we have reached the maximum number of * pools. */ -if (pools_num <DEPOT_MAX_POOLS ) +if (pools_num +1 <DEPOT_MAX_POOLS )WRITE_ONCE (new_pool,NULL );else WRITE_ONCE (new_pool,STACK_DEPOT_POISON );
Signature · 1 line
2.53.0