[lkml]   [2005]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    SubjectRe: [PATCH] i386 spinlocks should use the full 32 bits, not only 8 bits

    * Linus Torvalds <> wrote:

    > On Fri, 21 Oct 2005, Ingo Molnar wrote:
    > >
    > > the unlock is simple even in the preemption case
    > No it's not. It needs to decrement the preemption counter and test it.

    arghhh. Right you are. I even had the proper solution coded up initially
    (i had || defined(CONFIG_PREEMPT)) but dropped it due to fatal brain
    error. Been hacking on way too much ktimer code today ... Hopefully
    better patch attached. Booted on SMP+PREEMPT x86. But i'd really advise
    you against taking patches from me tonight :-|


    Signed-off-by: Ingo Molnar <>

    include/linux/spinlock.h | 15 ++++++++++++---
    1 files changed, 12 insertions(+), 3 deletions(-)

    Index: linux/include/linux/spinlock.h
    --- linux.orig/include/linux/spinlock.h
    +++ linux/include/linux/spinlock.h
    @@ -171,9 +171,18 @@ extern int __lockfunc generic__raw_read_
    #define write_lock_irq(lock) _write_lock_irq(lock)
    #define write_lock_bh(lock) _write_lock_bh(lock)

    -#define spin_unlock(lock) _spin_unlock(lock)
    -#define write_unlock(lock) _write_unlock(lock)
    -#define read_unlock(lock) _read_unlock(lock)
    + * We inline the unlock functions in the nondebug case:
    + */
    +#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT)
    +# define spin_unlock(lock) _spin_unlock(lock)
    +# define read_unlock(lock) _read_unlock(lock)
    +# define write_unlock(lock) _write_unlock(lock)
    +# define spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
    +# define read_unlock(lock) __raw_read_unlock(&(lock)->raw_lock)
    +# define write_unlock(lock) __raw_write_unlock(&(lock)->raw_lock)

    #define spin_unlock_irqrestore(lock, flags) \
    _spin_unlock_irqrestore(lock, flags)
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at
     \ /
      Last update: 2005-10-21 00:30    [W:0.023 / U:8.056 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site