Al Viro wrote:
On Wed, Apr 26, 2006 at 03:20:30PM +0800, Akinobu Mita wrote:
If this is good one and the places where Al Viro pointed out really affect
performance, should we propagate this faster one by introducing helper
function like:
static inline int refcount_test(atomic_t *refcount)
{
return (atomic_read(refcount) == 1) || (atomic_dec_and_test(refcount));
}
and replace atomic_dec_and_test with it?
No. It's obviously slower than atomic_dec_and_test() if refcount is
greater than 1. And I'm less than sure that you can show that benefits
in case when it is 1 outweight that.
Especially with the indirect function call. Modern CPUs often won't load
the destructor pointer quickly enough to avoid the pipeline bubble.
Moreover, for dentries, inodes,
superblocks and vfsmounts you'd have to pull spin_lock() in front of
it, which would _definitely_ hurt (these are atomic_dec_and_lock()).
Also, it results in altered memory barrier semantics. Whether or not
this is actually an issue anywhere, any conversion would have to be
careful. If a memory barrier is required _anywhere_, it is likely to
be required on the final put.
With all those arguments against it, you need to demonstrate
improvements before it can be considered.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]