From b11e10e2c81c2b608176021364a36d84173358e3 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 24 Sep 2023 10:35:10 +0000 Subject: percpu area using gs segment This speeds up smp again, by storing the struct processor in a percpu area and avoiding an expensive cpu_number every call of current_processor(), as well as getting the cpu_number by an offset into the percpu area. Untested on 64 bit and work remains to use other percpu arrays. TESTED: (NCPUS=8) -smp 1 boots to login shell ~2x slower than uniprocessor TESTED: (NCPUS=8) -smp 2 boots to INIT but hangs there TESTED: (NCPUS=8) -smp 4 gets stuck seemingly within rumpdisk and hangs TESTED: (NCPUS=1) uniprocessor is a bit faster than normal Message-Id: <20230924103428.455966-3-damien@zamaudio.com> --- kern/startup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'kern/startup.c') diff --git a/kern/startup.c b/kern/startup.c index 2eb3a739..88608c7d 100644 --- a/kern/startup.c +++ b/kern/startup.c @@ -74,6 +74,7 @@ boolean_t reboot_on_panic = TRUE; #if NCPUS > 1 #include +#include #include #endif /* NCPUS > 1 */ @@ -281,7 +282,7 @@ void cpu_launch_first_thread(thread_t th) { int mycpu; - mycpu = cpu_number(); + mycpu = cpu_number_slow(); cpu_up(mycpu); -- cgit v1.2.3