RE: [patch] printk subsystems

Manfred Spraul (manfred@colorfullife.com)
Thu, 24 Apr 2003 20:56:47 +0200


Robert wrote:

>There is both a qualitative difference and quantitative difference in a
>lockless algorithm as described versus one that uses locking. Most
>importantly for Linux, these algorithms in practice have better performance
>characteristics.
>
Do you have benchmark numbers that compare "lockless" and locking
algorithms on large MP systems?

For example, how much faster is one 'lock;cmpxchg' compared to
'spin_lock();if (x==var) var = y;spin_unlock();'.

So far I assumed that for spinlock that are only held for a few cycles,
the cacheline trashing dominates, and not the spinning.
I've avoided to replace spin_lock+inc+spin_unlock with atomic_inc().
(Just look at the needed memory barriers: smp_mb__after_clear_bit & friends)

RCU uses per-cpu queues that are really lockless and avoid the cache
trashing, that is a real win.

--
    Manfred

- 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/