summaryrefslogtreecommitdiff
path: root/kern/thread.c
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-08-05 15:49:08 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-06 15:40:31 +0200
commit955c51b4d43fbeb5b24d70d80203c05cbf2e6894 (patch)
treed7153a9e3294f1d55eb88d466a9146291173b72b /kern/thread.c
parentc9e2acff14cbacce707f07410744fad575f4b78b (diff)
kern/thread: Only loop over cpus that exist
Message-Id: <20230805154859.2003109-1-damien@zamaudio.com>
Diffstat (limited to 'kern/thread.c')
-rw-r--r--kern/thread.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kern/thread.c b/kern/thread.c
index a324eed7..9bbe8342 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -57,6 +57,7 @@
#include <kern/host.h>
#include <kern/kalloc.h>
#include <kern/slab.h>
+#include <kern/smp.h>
#include <kern/mach_clock.h>
#include <vm/vm_kern.h>
#include <vm/vm_user.h>
@@ -2570,7 +2571,7 @@ kern_return_t processor_set_stack_usage(
stack = thread->kernel_stack;
- for (cpu = 0; cpu < NCPUS; cpu++)
+ for (cpu = 0; cpu < smp_get_numcpus(); cpu++)
if (active_threads[cpu] == thread) {
stack = active_stacks[cpu];
break;