Addressing latency problems in 2.6
Posted Jul 31, 2004 4:28 UTC (Sat) by rlrevell
In reply to: Addressing latency problems in 2.6
Parent article: Addressing latency problems in 2.6
Because of the Big Kernel Lock, aka BKL. This was created as a way for the lazy to make old code 'SMP-safe' without having to implement proper, fine grained locking. This is a global lock, which differs from a spinlock in that it's recorsive and you can sleep while holding it. Unfortunately it disables preemption!
The problem with a facility like this is people will abuse it, because it's the easiest way to implement locking in your code, and before the kernel became preemptible, there was no cost to using the BKL vs. a proper lock on a UP. Many would have you think that the BKL is mostly a thing of the past, but it is still used, for example by ReiserFS for *all write locking*!
Many of the latency issues that have been eliminated recently in 2.6 involved eliminating or minimizing uses of the BKL. It has been suggested that the best way for a newbie to get up to speed on kernel hacking is to find a use of the BKL and replace it with a proper lock. Quoth Uresh Vahalia:
"System performance depends greatly on the locking granularity".
to post comments)