[RFC PATCH v2 41/43] exit: Use THREAD_SIZE_MAX for lowest_to_date
From: Eric Curtin
Date: Mon Nov 30 2026 - 20:53:57 EST
From: Eric Curtin <eric.curtin@xxxxxxxxxx>
With arm64 boot-time page size selection THREAD_SIZE may depend on the
page size and is not a compile-time constant, so it cannot initialise
the static lowest_to_date in check_stack_usage().
Use THREAD_SIZE_MAX, which is an upper bound on the stack size and so a
valid initial value for the lowest free stack seen so far.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
(cherry picked from commit e4b475ad2b5c70b4fa666356ca309ed3ec0528ed)
---
kernel/exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index a8453363d1fd..4a7d792f69ed 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -847,7 +847,7 @@ static inline void kstack_histogram(unsigned long used_stack)
static void check_stack_usage(void)
{
static DEFINE_SPINLOCK(low_water_lock);
- static int lowest_to_date = THREAD_SIZE;
+ static int lowest_to_date = THREAD_SIZE_MAX;
unsigned long free;
free = stack_not_used(current);