public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Akinobu Mita <mita@miraclelinux.com>
Cc: Al Viro <viro@ftp.linux.org.uk>, Greg KH <greg@kroah.com>,
	Jens Axboe <axboe@suse.de>,
	linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: [patch 3/3] use kref for bio
Date: Wed, 26 Apr 2006 19:29:15 +1000	[thread overview]
Message-ID: <444F3D6B.2070405@yahoo.com.au> (raw)
In-Reply-To: <20060426073944.GL27946@ftp.linux.org.uk>

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 

      reply	other threads:[~2006-04-26 16:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-26  2:10 [patch 0/3] use kref Akinobu Mita
2006-04-26  2:11 ` [patch 1/3] use kref for blk_queue_tag Akinobu Mita
2006-04-26  2:42   ` Nick Piggin
2006-04-26  5:17   ` Greg KH
2006-04-26  2:11 ` [patch 2/3] use kref for io_context Akinobu Mita
2006-04-26  2:11 ` [patch 3/3] use kref for bio Akinobu Mita
2006-04-26  2:26   ` Al Viro
2006-04-26  5:13     ` Jens Axboe
2006-04-26  5:18       ` Greg KH
2006-04-26  7:20         ` Akinobu Mita
2006-04-26  7:39           ` Al Viro
2006-04-26  9:29             ` Nick Piggin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=444F3D6B.2070405@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=axboe@suse.de \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mita@miraclelinux.com \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox