• Andrew Morton's avatar
    [PATCH] Un-inline spinlocks on ppc64 · 5dfd0a43
    Andrew Morton authored
    From: Paul Mackerras <paulus@samba.org>
    
    The patch below moves the ppc64 spinlocks and rwlocks out of line and into
    arch/ppc64/lib/locks.c, and implements _raw_spin_lock_flags for ppc64.
    
    Part of the motivation for moving the spinlocks and rwlocks out of line was
    that I needed to add code to the slow paths to yield the processor to the
    hypervisor on systems with shared processors.  On these systems, a cpu as
    seen by the kernel is a virtual processor that is not necessarily running
    full-time on a real physical cpu.  If we are spinning on a lock which is
    held by another virtual processor which is not running at the moment, we
    are just wasting time.  In such a situation it is better to do a hypervisor
    call to ask it to give the rest of our time slice to the lock holder so
    that forward progress can be made.
    
    The one problem with out-of-line spinlock routines is that lock contention
    will show up in profiles in the spin_lock etc.  routines rather than in the
    callers, as it does with inline spinlocks.  I have added a CONFIG_SPINLINE
    config option for people that want to do profiling.  In the longer term, Anton
    is talking about teaching the profiling code to attribute samples in the spin
    lock routines to the routine's caller.
    
    This patch reduces the kernel by about 80kB on my G5.  With inline
    spinlocks selected, the kernel gets about 4kB bigger than without the
    patch, because _raw_spin_lock_flags is slightly bigger than _raw_spin_lock.
    
    This patch depends on the patch from Keith Owens to add
    _raw_spin_lock_flags.
    5dfd0a43
Makefile 153 Bytes