LWN.net Logo

Addressing latency problems in 2.6

Addressing latency problems in 2.6

Posted Jul 31, 2004 4:28 UTC (Sat) by rlrevell (guest, #23596)
In reply to: Addressing latency problems in 2.6 by simlo
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".

Lee


(Log in to post comments)

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.