All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'James Simmons' <jsimmons@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	Andreas Dilger <andreas.dilger@intel.com>,
	"Oleg Drokin" <oleg.drokin@intel.com>,
	Lai Siyao <lai.siyao@intel.com>,
	"Jinshan Xiong" <jinshan.xiong@intel.com>,
	NeilBrown <neilb@suse.com>
Cc: Gu Zheng <gzheng@ddn.com>, Li Xi <lixi@ddn.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: RE: [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to rwlock
Date: Thu, 3 May 2018 13:50:07 +0000	[thread overview]
Message-ID: <a3594bd7c393418c8fda5150a075ff1a@AcuMS.aculab.com> (raw)
In-Reply-To: <1525285308-15347-2-git-send-email-jsimmons@infradead.org>

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)

	David

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

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

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)

	David

  reply	other threads:[~2018-05-03 13:50 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 [this message]
2018-05-03 13:50     ` David Laight
2018-05-03 23:26     ` NeilBrown
2018-05-03 23:26       ` [lustre-devel] " NeilBrown
2018-05-04  0:11     ` Dilger, Andreas
2018-05-04  0:11       ` [lustre-devel] " 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=a3594bd7c393418c8fda5150a075ff1a@AcuMS.aculab.com \
    --to=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=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.