Lock totals in 2.5

Why are the lock totals increasing?

In the table below, locking documents do not exist for all releases. In fact, currently, they do not exist for any 2.5 releases. For most releases it is easy to count the locks but more labor intensive to update a full-fledged reference doc. When a document exists for a 2.5 release, most likely 2.5.19 within the next few weeks, there will be a hyperlink for it.

2.5 tree
Versions of documents available
Versions of Linux releases with links have documents for them; other lines are just lock counts.
Linux version # of global regular spinlocks # of global read/write spinlocks # of files using BKL
2.5.75 95 29 255
2.5.19 72 26 312
2.5.18 71 26 313
2.5.17 70 26 315
2.5.16 70 26 314
2.5.15 70 26 310
2.5.14 69 26 310
2.5.13 69 26 311
2.5.12 69 26 311
2.5.11 68 26 293
2.5.10 68 26 298
2.5.9 68 26 292
2.5.8 68 26 291
2.5.7 68 26 289
2.5.3 66 23 232
2.5.2 64 23 225
2.5.1 65 23 225
2.5.0 73 23 281

So why are the lock totals increasing?

There are two counts that are increasing. The first is the number of global spinlocks. This is increasing slowly because of the way developers, even in an unstable "development" tree like 2.5, prefer to phase in new locking. As some of the major bottlenecks are addressed, the old locks are not removed until the developer is sure that doing so will not have undesirable side effects. Meanwhile, new locks are created in the new code to take over the old functions. We should expect the number to (just as slowly) go down as 2.5 comes to a close and 2.6 comes out.

The other count increasing is the number of files utilizing the BKL (Big Kernel Lock). There is a similar although not identical effect happening here. In several cases, it has been determined that a function no longer needs to use the BKL. However, that function calls several other functions, often defined in separate device drivers, which the fixing coder doesn't know very well. He doesn't know if those drivers (incorrectly) depend on the locking that is being discarded. In order to keep broken code to a minimum, the grabbing of the BKL is pushed down to the functions below it and it is left up to a later effort or the maintainers of that code to determine whether it is also safe to remove it from those functions. Thus "removing" the BKL from one function might cause it to appear in five others. In theory, however, the correctness of those five functions should be easier to determine and that code, then, quickly cleaned up. (In practice, it's not always so quick.)

If maintainers are conscientious, the number of files using the BKL will slowly decrease. If not, they will stay steady until somebody makes a significant effort to clean up all the code at once, as Dave Hansen did between 2.5.0 and 2.5.1.

Patches to reduce global locks and BKL usage.

Return to lock hierarchy page.
Return to LSE home page.

Comments/questions to nevdull

Last updated: 6/1/02

SourceForge Logo