On 15/06/18 10:31, Almudena Garcia wrote: > Yes, I concluded the same a few hours ago. I tried to edit > kern/cpu_number.h, to add a new definition with many cores, at this form > > 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_L1_SIZE (1 << CPU_L1_SHIFT) > > #else > #define cpu_number() (NCPUS) >
I may be wrong, but that does not seem correct. The man page for cpu_number() state it to be "an unique CPU identification number for the CPU that this thread is running on". So it clearly can change at runtime if there are 2+ CPUs on the machine. Whereas NCPUS is being used by the precompiler as an integer with fixed value that can be known at pre-compile time. Implied by the "#if NCPUS > 1" statement which this version of the code omits. AYJ