Re: [RFC] unify semaphore implementations

From: Trond Myklebust (trond.myklebust_at_fys.uio.no)
Date: 04/30/05

  • Next message: Zwane Mwaikambo: "Re: 2.6.12-rc3-mm1"
    To: Paul Mackerras <paulus@samba.org>
    Date:	Sat, 30 Apr 2005 12:40:29 -0400
    
    

    On lau , 2005-04-30 at 11:45 +1000, Paul Mackerras wrote:

    > What is "your machine"? Is a single cmpxchg really slower than
    > locking and unlocking a spinlock? If so, by how much?

    Sorry. Thinking back, I realize that I was testing the non-irqsafe
    spinlocks, since that was the only case that was of interest for the
    iosem stuff. I should go back and test for the case of irqsafe ones.

    FYI, though, the machine on which I tested it is a mobile P4. When
    averaging over 1000 iterations, a single bus-locked cmpxchg took more
    than twice the amount of time to complete than a single bus-locked incb
    or decb (as used in the 386 spinlock implementations).
    The spinlocked version was therefore not much faster for the fast path,
    but for the slow path you do only a single spin_lock/spin_unlock
    combination instead of cmpxchg+spinlock/spinunlock. It is therefore
    twice as fast.

    Cheers,
      Trond

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Zwane Mwaikambo: "Re: 2.6.12-rc3-mm1"

    Relevant Pages

    • Re: [RFC] unify semaphore implementations
      ... > can still do a spinlock semaphore implementation instead of an atomic op ... the old fast path for the semaphores and the new fast path pretty much ... equivalent (they both take and release one spinlock). ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Can I call KeAcquireSpinLockAtDpcLevel at DISPATCH_LEVEL?
      ... SpinLock in a DPC (as long as I observe the rules of 25 microseconds, ... not aquiring it twice, etc.). ...
      (microsoft.public.development.device.drivers)
    • Re: 2.6.4-rc1-mm1: queue-congestion-dm-implementation patch
      ... it must wait on an internal semaphore ... > problem is that the higher-level caller is holding a spinlock at the same ... reproduce it I can try a few things.. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH]: Clean up of __alloc_pages
      ... Not to mention that a spinlock is an atomic op (though that is getting ... cheaper these days) + 2 memory barriers. ... Send instant messages to your online friends http://au.messenger.yahoo.com ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: serial driver / tty issues
      ... we should drop the spinlock and re-acquire it afterwards. ... and eventually cancel the work queue. ... > won't call the ldisc functions after we've closed them down. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)