Re: [PATCH] atomic: add atomic_inc_not_zero_hint()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Monday, November 15, 2010 - 7:47 am

Le lundi 15 novembre 2010 à 08:25 -0600, Christoph Lameter a écrit :

Yes, this is what cmpxchg() does for sure.


Maybe its not clear, but atomic_inc_not_zero_hint() is going to be used
only in contexts we know the expected value, and not as a generic
replacement for atomic_inc_not_zero(). Even if cache line is already hot
in this cpu cache, it should be faster or same speed.

Then, in high contention contexts, using atomic_inc_not_zero_hint() with
whatever initial hint might also be a win over atomic_inc_not_zero(),
but we try to remove such contexts ;)

And two atomic_cmpxchg() are probably slower in non contended contexts,
in particular is cache line is already hot in this cpu cache.


In fact, in benchmarks, prefetch() or prefetchw() are a pain on x86, or
at least "perf tools" show artifact on them (high number of cycles
consumed on these instructions)

Andi had a patch to disable prefetch() in list iterators, and its a win.

I dont have Itanium platform to run tests. Is cmpxchg() that bad on
ia64 ? I also have old AMD cpus, so I cannot say if recent ones handle
prefetchw() better...



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Fri Nov 5, 9:53 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Andrew Morton, (Fri Nov 5, 10:20 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Fri Nov 5, 11:00 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Andrew Morton, (Fri Nov 5, 11:08 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Fri Nov 5, 11:20 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Andrew Morton, (Fri Nov 5, 11:28 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Paul E. McKenney, (Fri Nov 5, 11:40 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Fri Nov 5, 12:12 pm)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Fri Nov 5, 12:20 pm)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Andrew Morton, (Fri Nov 5, 12:39 pm)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Fri Nov 5, 12:46 pm)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Paul E. McKenney, (Fri Nov 5, 12:51 pm)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Christoph Lameter, (Fri Nov 12, 12:14 pm)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Paul E. McKenney, (Sat Nov 13, 3:26 pm)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Christoph Lameter, (Mon Nov 15, 6:57 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Andi Kleen, (Mon Nov 15, 7:07 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Christoph Lameter, (Mon Nov 15, 7:16 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Mon Nov 15, 7:17 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Christoph Lameter, (Mon Nov 15, 7:25 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Andi Kleen, (Mon Nov 15, 7:39 am)
Re: [PATCH] atomic: add atomic_inc_not_zero_hint(), Eric Dumazet, (Mon Nov 15, 7:47 am)