All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Gu Zheng <gzheng@ddn.com>, Li Xi <lixi@ddn.com>,
	NeilBrown <neilb@suse.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Drokin, Oleg" <oleg.drokin@intel.com>,
	Jinshan Xiong <jinshan.xiong@intel.com>,
	"Siyao, Lai" <lai.siyao@intel.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to rwlock
Date: Fri, 4 May 2018 00:11:54 +0000	[thread overview]
Message-ID: <55458B75-4105-4F4F-BB50-3D506611AB24@intel.com> (raw)
In-Reply-To: <a3594bd7c393418c8fda5150a075ff1a@AcuMS.aculab.com>

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 said, it might be good to include this information into the
commit comment itself.

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation







_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

WARNING: multiple messages have this Message-ID (diff)
From: Dilger, Andreas <andreas.dilger@intel.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Gu Zheng <gzheng@ddn.com>, Li Xi <lixi@ddn.com>,
	NeilBrown <neilb@suse.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Drokin, Oleg" <oleg.drokin@intel.com>,
	Jinshan Xiong <jinshan.xiong@intel.com>,
	"Siyao, Lai" <lai.siyao@intel.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to rwlock
Date: Fri, 4 May 2018 00:11:54 +0000	[thread overview]
Message-ID: <55458B75-4105-4F4F-BB50-3D506611AB24@intel.com> (raw)
In-Reply-To: <a3594bd7c393418c8fda5150a075ff1a@AcuMS.aculab.com>

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 said, it might be good to include this information into the
commit comment itself.

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation

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

Thread overview: 42+ 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 ` [lustre-devel] " James Simmons
2018-05-02 18:21 ` [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to rwlock James Simmons
2018-05-02 18:21   ` [lustre-devel] " James Simmons
2018-05-03 13:50   ` David Laight
2018-05-03 13:50     ` [lustre-devel] " David Laight
2018-05-03 23:26     ` NeilBrown
2018-05-03 23:26       ` [lustre-devel] " NeilBrown
2018-05-04  0:11     ` Dilger, Andreas [this message]
2018-05-04  0:11       ` Dilger, Andreas
2018-05-04  0:53       ` NeilBrown
2018-05-04  0:53         ` [lustre-devel] " NeilBrown
2018-05-02 18:21 ` [PATCH 2/4] staging: lustre: obdclass: hoist locking in lu_context_exit() James Simmons
2018-05-02 18:21   ` [lustre-devel] " James Simmons
2018-05-02 18:21 ` [PATCH 3/4] staging: lustre: obdclass: guarantee all keys filled James Simmons
2018-05-02 18:21   ` [lustre-devel] " James Simmons
2018-05-02 18:21 ` [PATCH 4/4] staging: lustre: obdclass: change object lookup to no wait mode James Simmons
2018-05-02 18:21   ` [lustre-devel] " James Simmons
2018-05-04  1:15   ` NeilBrown
2018-05-04  1:15     ` [lustre-devel] " NeilBrown
2018-05-15  0:37     ` James Simmons
2018-05-15  0:37       ` [lustre-devel] " James Simmons
2018-05-15  1:37       ` NeilBrown
2018-05-15  1:37         ` [lustre-devel] " NeilBrown
2018-05-15  2:11         ` James Simmons
2018-05-15  2:11           ` [lustre-devel] " James Simmons
2018-05-07  1:47   ` Greg Kroah-Hartman
2018-05-07  1:47     ` [lustre-devel] " Greg Kroah-Hartman
2018-05-08 11:45   ` Dan Carpenter
2018-05-08 11:45     ` [lustre-devel] " Dan Carpenter
2018-05-15 15:02     ` James Simmons
2018-05-15 15:02       ` [lustre-devel] " James Simmons
2018-05-16  8:00       ` Dan Carpenter
2018-05-16  8:00         ` [lustre-devel] " Dan Carpenter
2018-05-16  9:12         ` Dilger, Andreas
2018-05-16  9:12           ` [lustre-devel] " Dilger, Andreas
2018-05-16 15:44           ` Joe Perches
2018-05-16 15:44             ` [lustre-devel] " Joe Perches
2018-05-16 16:57       ` Greg Kroah-Hartman
2018-05-16 16:57         ` [lustre-devel] " Greg Kroah-Hartman
2018-05-17  5:07         ` James Simmons
2018-05-17  5:07           ` [lustre-devel] " 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=55458B75-4105-4F4F-BB50-3D506611AB24@intel.com \
    --to=andreas.dilger@intel.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gzheng@ddn.com \
    --cc=jinshan.xiong@intel.com \
    --cc=lai.siyao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixi@ddn.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.