From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758871AbdEONDH (ORCPT ); Mon, 15 May 2017 09:03:07 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:58215 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756459AbdEONDG (ORCPT ); Mon, 15 May 2017 09:03:06 -0400 Date: Mon, 15 May 2017 15:02:57 +0200 From: Peter Zijlstra To: Davidlohr Bueso Cc: mingo@kernel.org, akpm@linux-foundation.org, jack@suse.cz, kirill.shutemov@linux.intel.com, ldufour@linux.vnet.ibm.com, mhocko@suse.com, mgorman@techsingularity.net, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 2/6] locking: Introduce range reader/writer lock Message-ID: <20170515130257.n4q72dodbd3x4fvm@hirez.programming.kicks-ass.net> References: <20170515090725.27055-1-dave@stgolabs.net> <20170515090725.27055-3-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170515090725.27055-3-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 On Mon, May 15, 2017 at 02:07:21AM -0700, Davidlohr Bueso wrote: > + * Fairness and freedom of starvation are guaranteed by the lack of lock > + * stealing, thus range locks depend directly on interval tree semantics. > + * This is particularly for iterations, where the key for the rbtree is > + * given by the interval's low endpoint, So suppose the lock is held at [a,n], and I want to acquire [g,z], this conflicts, therefore I wait. While I wait, someone else comes in at [b,m], they too wait. [a,n] is released, per ordering [b,m] acquires, I still wait. [a,n] returns to wait. [b,m] releases, does the iteration then restart and grant it to [a,n] or will I (at [g,z]) finally acquire? Since the code always does range_interval_tree_foreach() it would appear to me [b,m] will always win and [g,z] could be made to wait indefinitely (by always contending with another range that has a lower starting point). > and duplicates are walked as it > + * would an inorder traversal of the tree. Are duplicates ordered in FIFO ? Afaict the above is free of actual semantics.