From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fieldses.org ([173.255.197.46]:49516 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbeHJDcq (ORCPT ); Thu, 9 Aug 2018 23:32:46 -0400 Date: Thu, 9 Aug 2018 21:05:19 -0400 From: "J. Bruce Fields" To: NeilBrown Cc: Jeff Layton , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Wilck Subject: Re: [PATCH 0/4] locks: avoid thundering-herd wake-ups Message-ID: <20180810010519.GD3915@fieldses.org> References: <153369219467.12605.13472423449508444601.stgit@noble> <20180808195445.GD23873@fieldses.org> <20180808200912.GE23873@fieldses.org> <20180808212832.GF23873@fieldses.org> <04ffa27c29d2bff8bd9cb9b6d4ea6b6fd3969b6c.camel@kernel.org> <20180809130001.GG23873@fieldses.org> <877ekzrt60.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877ekzrt60.fsf@notabene.neil.brown.name> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Aug 10, 2018 at 09:56:07AM +1000, NeilBrown wrote: > On Thu, Aug 09 2018, J. Bruce Fields wrote: > > If we only cared about the former, and only in simple cases, we could > > walk the entire list and skip waking up only the locks that conflict > > with the first one we wake. We wouldn't need the tree. > > Yes, we could do that. It would probably make the code simpler. > It would mean doing the conflicts() tests when performing wake-up rather > than prior to going to sleep. In general it would mean doing the tests > more often, as the tree effectively records the results of the previous > time conflicts() was run. > You might get a quadratic effect though ... wouldn't you want to > skip anything that conflicts with anything that has been woken? I was thinking it'd be simplest just to check for conflict with the first thing that you decide to wake. That might be all that's necessary for typical cases. If you wanted to keep a running list of the locks you've chosen to wake so far and check each one against that list, I guess you could. > If the tree-management code turns out to be too complex, it would > certainly be an option. I think the tree approach should result in less > total CPU usage.. Have we ever looked into the CPU usage of deadlock detection? Might experiment with turning that off. But I may be biased by my white-hot hatred of it. --b.