[patch] powerpc: native atomic_add_unless

Nick Piggin npiggin at suse.de
Fri Feb 24 14:47:19 EST 2006


On Thu, Feb 23, 2006 at 09:35:02PM +1100, Paul Mackerras wrote:
> Nick Piggin writes:
> 
> > atomic_add_unless (atomic_inc_not_zero) is used in several hot paths in the
> > vfs and I'm planning some uses in the memory manager, so it should be as
> > small and fast as possible.
> > 
> > Joel had a good suggestion to save a register but all bugs are mine.
> > 
> > Comments?
> 
> The implementation looks OK.  I would be interested to know if this
> actually makes any measurable difference though.
> 

I tried to microbenchmark it in userspace but couldn't get significant
results for a single thread.

When the cacheline is not hot or there is some contention, I hoped the
native version might result in less coherency protocol operations.

There are less branches and it should use less I cache too.

All things that are difficult to test in microbenchmarks, unfortunately.




More information about the Linuxppc64-dev mailing list