Linux Operating System Source Code: IBM Patches

 
reduce code in generic spinlock.h
Description:
The last time lockmeter was ported to 2.5, it was getting a little
messy.  There were separate declarations for spin_*lock() for each
combination of lockmeter and preemption, which made four, plus the
no-smp definition.  While lockmeter's mess isn't the kernel's fault, 
we noticed some some simplifications which could be made to the 
generic spinlock code.  This patch uses a single definition for each 
of the macros, eliminating some redundant code.

In the preemption-off case, spin lock is changed from this:
_raw_spin_lock(lock)
to this:
do {
	preempt_disable();
	_raw_spin_lock(lock)
} while (0)
The preemption-on case is unchanged.

Since preempt_disable() is a do{}while(0) with preemption off anyway,
it gets back to the same effective result as before, with a little
extra work from the compiler.  The preempt_disable() macro just had to
be moved up in the file a bit.

Thanks to Adam Litke , who has been doing the
lockmeter port and who initially wrote this patch.

Compiles in all combinations of SMP and preempt.
Developer:
Dave Hansen
Status:
Submitted to project

Notes:
Superceeded by a patch by Robert Love which was much more aggressive. This patch will not be included in the kernel, but may have served as a catalyst for the more radical changes.
Release Notes Date Files
20020820 Release Notes 2002-08-20  
  File Notes   spinlock-cleanup-2.5.27-2.diff.gz