* + stackdepot-stop-preallocating-after-the-final-pool.patch added to mm-nonmm-unstable branch
@ 2026-10-22 15:48 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-10-22 15:48 UTC (permalink / raw)
To: mm-commits, vbabka, stable, mikhail.v.gavrilov, mfleming, glider,
elver, dvyukov, calebkan1106, andreyknvl, ckan, akpm
The patch titled
Subject: stackdepot: stop preallocating after the final pool
has been added to the -mm mm-nonmm-unstable branch. Its filename is
stackdepot-stop-preallocating-after-the-final-pool.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/stackdepot-stop-preallocating-after-the-final-pool.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Caleb Kan <ckan@cloudflare.com>
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.
Link: https://lore.kernel.org/20261022083330.3159793-1-matt@readmodwrite.com
Fixes: 31639fd6cebd ("stackdepot: use variable size records for non-evictable entries")
Signed-off-by: Caleb Kan <ckan@cloudflare.com>
Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Cc: Caleb Kan <calebkan1106@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: <stable@vger.kernel.org>
---
lib/stackdepot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/lib/stackdepot.c~stackdepot-stop-preallocating-after-the-final-pool
+++ a/lib/stackdepot.c
@@ -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 ckan@cloudflare.com are
stackdepot-stop-preallocating-after-the-final-pool.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-22 15:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-22 15:48 + stackdepot-stop-preallocating-after-the-final-pool.patch added to mm-nonmm-unstable branch Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox