Patch page for reducing global locks


Patches to remove static locks Patches to reduce BKL usage

This page contains a summary of patches available to remove some global locks. Do not expect these, by themselves, to make any real difference in terms of performance. Neither, of course, should applying them cause any harm. However, removing global locks, and decreasing unnecessary usage of the BKL (Big Kernel Lock) helps teams working on performance by removing false echoes from their "performance radar screen." By removing these unnecessary locks or usages of locks, it makes it easier to track down real locking issues without having to sort through these usages which are known to be unnecessary.

One of the goals of LSE is not only to insure that Linux scales well on large SMP and NUMA machines, but also to permanently remove unnecessary locking from the Linux kernel. Proper locking can provide significant performance enhancements, but as mentioned above, these patches simply make the search easier. We will be pushing to get them incorporated into future Linux releases by working with the maintainers, and where that has happened, it is noted in the charts following.

The patches above fall into two categories: removal of global locks (typically, by making them static to the file in which they are used) and removal of unnecessary lock_kernel()/unlock_kernel() calls. The bulk of these last were found in device driver "release" functions after a change by Alexander Viro in 2.4.0 shortly before it was released. Due to the desire to release 2.4.0 with minimum risk, his changes took a very cautious approach and moved locking in one part of the kernel out to the device drivers, even though it was not clear that locking was still needed. Further research has shown that in 90% of the cases, it's not needed. (In the other 10% of the cases, it was wrong to begin with and presence or absence of the BKL doesn't change anything.)

In the case of static locks, the patches are simplistic enough that they can apply to nearly any release of 2.4.x (allowing for occasional fuzz as line numbers change slightly.) The BKL changes, especially the ones that fix the locking rather than simply remove the BKL, tend not to be so flexible. The BKL changes are based on 2.4.14, and the more you drift from that, the less seamlessly the patches apply. Still, the failures are usually easily fixed by hand.

Return to LSE home page.

Comments/questions to nevdull

Last updated: 11/21/01

SourceForge Logo