• Linus Torvalds's avatar
    BKL: revert back to the old spinlock implementation · 8e3e076c
    Linus Torvalds authored
    The generic semaphore rewrite had a huge performance regression on AIM7
    (and potentially other BKL-heavy benchmarks) because the generic
    semaphores had been rewritten to be simple to understand and fair.  The
    latter, in particular, turns a semaphore-based BKL implementation into a
    mess of scheduling.
    
    The attempt to fix the performance regression failed miserably (see the
    previous commit 00b41ec2 'Revert
    "semaphore: fix"'), and so for now the simple and sane approach is to
    instead just go back to the old spinlock-based BKL implementation that
    never had any issues like this.
    
    This patch also has the advantage of being reported to fix the
    regression completely according to Yanmin Zhang, unlike the semaphore
    hack which still left a couple percentage point regression.
    
    As a spinlock, the BKL obviously has the potential to be a latency
    issue, but it's not really any different from any other spinlock in that
    respect.  We do want to get rid of the BKL asap, but that has been the
    plan for several years.
    
    These days, the biggest users are in the tty layer (open/release in
    particular) and Alan holds out some hope:
    
      "tty release is probably a few months away from getting cured - I'm
       afraid it will almost certainly be the very last user of the BKL in
       tty to get fixed as it depends on everything else being sanely locked."
    
    so while we're not there yet, we do have a plan of action.
    Tested-by: default avatarYanmin Zhang <yanmin_zhang@linux.intel.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Matthew Wilcox <matthew@wil.cx>
    Cc: Alexander Viro <viro@ftp.linux.org.uk>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    8e3e076c
sched.c 220 KB