Re: [patch 3/3] use kref for bio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 25, 2006 at 10:18:13PM -0700, Greg KH wrote:
> > > Let's _not_.  It's extra overhead for no good reason.
> > 
> > Completely agree. That goes for the other block layer kref patches as
> > well.
> 
> I also agree, there's a reason I never tried to convert them in the past
> :)

kref has faster function for decrement refcount.

kref_put()
{
...

	/*
	 * if current count is one, we are the last user and can release object
	 * right now, avoiding an atomic operation on 'refcount'
	 */
	if ((atomic_read(&kref->refcount) == 1) ||
		(atomic_dec_and_test(&kref->refcount))) {
		release(kref);
		return 1;
	}

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?

-
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]
  Powered by Linux