linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: "Dilger\, Andreas" <andreas.dilger@intel.com>,
	David Laight <David.Laight@ACULAB.COM>
Cc: James Simmons <jsimmons@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"devel\@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"Drokin\, Oleg" <oleg.drokin@intel.com>, "Siyao\,
	Lai" <lai.siyao@intel.com>,
	Jinshan Xiong <jinshan.xiong@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>,
	Li Xi <lixi@ddn.com>, Gu Zheng <gzheng@ddn.com>
Subject: Re: [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to rwlock
Date: Fri, 04 May 2018 10:53:36 +1000	[thread overview]
Message-ID: <87a7tgfdgv.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <55458B75-4105-4F4F-BB50-3D506611AB24@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]

On Fri, May 04 2018, Dilger, Andreas wrote:

> On May 3, 2018, at 07:50, David Laight <David.Laight@ACULAB.COM> wrote:
>> 
>> From: James Simmons
>>> Sent: 02 May 2018 19:22
>>> From: Li Xi <lixi@ddn.com>
>>> 
>>> Most of the time, keys are never changed. So rwlock might be
>>> better for the concurrency of key read.
>> 
>> OTOH unless there is contention on the spin lock during reads the
>> additional cost of a rwlock (probably double that of a spinlock)
>> will hurt performance.
>> 
>> ...
>>> -	spin_lock(&lu_keys_guard);
>>> +	read_lock(&lu_keys_guard);
>>> 	atomic_inc(&lu_key_initing_cnt);
>>> -	spin_unlock(&lu_keys_guard);
>>> +	read_unlock(&lu_keys_guard);
>> 
>> WTF, seems unlikely that you need to hold any kind of lock
>> over an atomic_inc().
>> 
>> If this is just ensuring that no code holds the lock then
>> it would need to request the write_lock().
>> (and would need a comment)
>
> There was a fair amount of benchmarking done for this that shows the
> performance is significantly improved with the patch, which can be
> seen in the ticket that was referenced in the original commit comment:
>
> https://jira.hpdd.intel.com/browse/LU-6800?focusedCommentId=121776#comment-121776

That does surprise me.  The only places where the lock is held for read
are very short - clearing a few fields or incrementing a value.
But numbers don't lie.
I wonder if the next patch would have had just as big an effect. Taking
and dropping the lock 40 times is not likely to be good for performance.

Thanks,
NeilBrown


>
> That said, it might be good to include this information into the
> commit comment itself.
>
> Cheers, Andreas
> --
> Andreas Dilger
> Lustre Principal Architect
> Intel Corporation

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2018-05-04  0:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 18:21 [PATCH 0/4] staging: lustre: obdclass: missing lu_object fixes James Simmons
2018-05-02 18:21 ` [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to rwlock James Simmons
2018-05-03 13:50   ` David Laight
2018-05-03 23:26     ` NeilBrown
2018-05-04  0:11     ` Dilger, Andreas
2018-05-04  0:53       ` NeilBrown [this message]
2018-05-02 18:21 ` [PATCH 2/4] staging: lustre: obdclass: hoist locking in lu_context_exit() James Simmons
2018-05-02 18:21 ` [PATCH 3/4] staging: lustre: obdclass: guarantee all keys filled James Simmons
2018-05-02 18:21 ` [PATCH 4/4] staging: lustre: obdclass: change object lookup to no wait mode James Simmons
2018-05-04  1:15   ` NeilBrown
2018-05-15  0:37     ` James Simmons
2018-05-15  1:37       ` NeilBrown
2018-05-15  2:11         ` James Simmons
2018-05-07  1:47   ` Greg Kroah-Hartman
2018-05-08 11:45   ` Dan Carpenter
2018-05-15 15:02     ` James Simmons
2018-05-16  8:00       ` Dan Carpenter
2018-05-16  9:12         ` Dilger, Andreas
2018-05-16 15:44           ` Joe Perches
2018-05-16 16:57       ` Greg Kroah-Hartman
2018-05-17  5:07         ` James Simmons

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=87a7tgfdgv.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gzheng@ddn.com \
    --cc=jinshan.xiong@intel.com \
    --cc=jsimmons@infradead.org \
    --cc=lai.siyao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixi@ddn.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).