- to isolate execution inside kernel we use a big kernel lock implemented as a spinlock - the lock is acquired asap after entering kernel mode and released as late as possible. Only one CPU as a time can execute the core kernel code - measurement son real hw show that the overhead of this lock is close to 0% of kernel time for the currnet system - the overhead of this lock may be as high as 45% of kernel time in virtual machines depending on the ratio between physical CPUs available and emulated CPUs. The performance degradation is significant
10 lines
146 B
C
10 lines
146 B
C
#include "smp.h"
|
|
|
|
unsigned ncpus;
|
|
unsigned ht_per_core;
|
|
unsigned bsp_cpu_id;
|
|
|
|
struct cpu cpus[CONFIG_MAX_CPUS];
|
|
|
|
SPINLOCK_DEFINE(big_kernel_lock)
|