Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754816AbdC2I7e (ORCPT ); Wed, 29 Mar 2017 04:59:34 -0400 Received: from merlin.infradead.org ([205.233.59.134]:60676 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753355AbdC2I7c (ORCPT ); Wed, 29 Mar 2017 04:59:32 -0400 Date: Wed, 29 Mar 2017 10:59:15 +0200 From: Peter Zijlstra To: Davidlohr Bueso Cc: mingo@kernel.org, akpm@linux-foundation.org, jack@suse.cz, kirill.shutemov@linux.intel.com, mhocko@suse.com, mgorman@techsingularity.net, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 1/5] locking: Introduce range reader/writer lock Message-ID: <20170329085915.szzmxkvipijcd45k@hirez.programming.kicks-ass.net> References: <1488863010-13028-1-git-send-email-dave@stgolabs.net> <1488863010-13028-2-git-send-email-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1488863010-13028-2-git-send-email-dave@stgolabs.net> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 995 Lines: 20 On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +++ b/kernel/locking/range_rwlock.c > @@ -0,0 +1,462 @@ > +/* > + * Implementation of read/write range locks. > + * > + * We keep interval tree of locked and to-be-locked ranges. When new range lock > + * is requested, we add its interval to the tree and store number of intervals > + * intersecting it to 'blocking_ranges'. > + * > + * When a range is unlocked, we again walk intervals that intersect with the > + * unlocked one and decrement their 'blocking_ranges'. We wake up owner of any > + * range lock whose 'blocking_ranges' drops to 0. For the shared case, the > + * 'blocking_ranges' is only incremented if the intersecting range is not marked > + * as a reader. In order to mitigate some of the tree walk overhead for > + * non-intersecting ranges, the tree's min/max values are maintained and consulted > + * in O(1) in the fastpath. > + */ Was your editor broken? Those lines are > 80 for no reason what so ever.