From mboxrd@z Thu Jan 1 00:00:00 1970 From: J. Bruce Fields Date: Thu, 13 Jun 2013 11:20:36 -0400 Subject: [Cluster-devel] [PATCH v2 12/14] locks: give the blocked_hash its own spinlock In-Reply-To: <20130613111844.59421622@corrin.poochiereds.net> References: <1370948948-31784-1-git-send-email-jlayton@redhat.com> <1370948948-31784-13-git-send-email-jlayton@redhat.com> <20130613150247.GB20666@fieldses.org> <20130613111844.59421622@corrin.poochiereds.net> Message-ID: <20130613152036.GC20666@fieldses.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu, Jun 13, 2013 at 11:18:44AM -0400, Jeff Layton wrote: > On Thu, 13 Jun 2013 11:02:47 -0400 > "J. Bruce Fields" wrote: > > > On Tue, Jun 11, 2013 at 07:09:06AM -0400, Jeff Layton wrote: > > > There's no reason we have to protect the blocked_hash and file_lock_list > > > with the same spinlock. With the tests I have, breaking it in two gives > > > a barely measurable performance benefit, but it seems reasonable to make > > > this locking as granular as possible. > > > > Out of curiosity... In the typical case when adding/removing a lock, > > aren't both lists being modified in rapid succession? > > > > I wonder if it would be better to instead stick with one lock and take > > care to acquire it only once to cover both manipulations. > > > > --b. > > > > That's not really the case... > > Typically, when doing a call into __posix_lock_file with FL_SLEEP set, > we either end up blocking on the lock or acquiring it. In either case, > we'll only end up taking one of the global spinlocks. The reason for > this is that blocker is what dequeues a waiter from the blocked_hash > before waking it up (in locks_wake_up_posix_blocks). > > Also, while this patch description doesn't spell it out, we require a > truly global lock for deadlock detection. In a later patch though, I > convert the file_lock_lock to a per-cpu spinlock. So we really do need > to separate the locks here in order to make the per-cpu file_lock_list > worthwhile. Oh, right, got it! --b.