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/cpu_number.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'kern/cpu_number.h') diff --git a/kern/cpu_number.h b/kern/cpu_number.h index 0be2d338..1abe3dbb 100644 --- a/kern/cpu_number.h +++ b/kern/cpu_number.h @@ -37,7 +37,8 @@ extern int master_cpu; /* 'master' processor - keeps time */ #if (NCPUS == 1) /* cpu number is always 0 on a single processor system */ -#define cpu_number() (0) +#define cpu_number() (0) +#define cpu_number_slow() (0) #endif /* NCPUS == 1 */ -- cgit v1.2.3