[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3594bd7c393418c8fda5150a075ff1a@AcuMS.aculab.com>
Date: Thu, 3 May 2018 13:50:07 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'James Simmons' <jsimmons@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
Andreas Dilger <andreas.dilger@...el.com>,
"Oleg Drokin" <oleg.drokin@...el.com>,
Lai Siyao <lai.siyao@...el.com>,
"Jinshan Xiong" <jinshan.xiong@...el.com>,
NeilBrown <neilb@...e.com>
CC: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Lustre Development List" <lustre-devel@...ts.lustre.org>,
Li Xi <lixi@....com>, "Gu Zheng" <gzheng@....com>
Subject: RE: [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to
rwlock
From: James Simmons
> Sent: 02 May 2018 19:22
> From: Li Xi <lixi@....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
Powered by blists - more mailing lists