remove the BKL (Big Kernel Lock), this time for real
Quoted 3 lines · Tony
I coded a IPC system before use atomic add + share memory. It works very well (fast) on 4 CPU SMP system, since it doesn't use any locking API at all. Very good for resource allocation for SMP. I implemented speciall malloc/free use by ISR, different
prority process completely without any lock.
Without any lock or without any common cacheline that are accessed by atomic operations?
I usually consider the costs of
atomic_inc(&global_atomic_var);
and
spin_lock(&global_lock);
global_var++;
spin_unlock(&global_lock);
as nearly identical (assuming that global_var and global_lock are in the same cacheline): one cachline transfer per run. The 5 instructions under the spinlock and the theoretical chance that spin_lock() blocks are noise compared to the cost of the line transfer. And that's without thinking about smb_mb__{before,after}_atomic_inc().
Btw, Ingo forgot to mention sequence locks and percpu_counter as two high-scalability locking primitives.
--
Manfred
Quoted 2 lines · Manfred Spraul
Btw, Ingo forgot to mention sequence locks and
percpu_counteras two high-scalability locking primitives.
yeah.
Ingo