From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964946AbcALPJ6 (ORCPT ); Tue, 12 Jan 2016 10:09:58 -0500 Received: from mx2.suse.de ([195.135.220.15]:34370 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753124AbcALPJy (ORCPT ); Tue, 12 Jan 2016 10:09:54 -0500 Date: Tue, 12 Jan 2016 07:09:46 -0800 From: Davidlohr Bueso To: Peter Zijlstra Cc: Andrew Morton , linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH] rbtree: use READ_ONCE in RB_EMPTY_ROOT Message-ID: <20160112150946.GA1927@linux-uzut.site> References: <1452536563-1762-1-git-send-email-dave@stgolabs.net> <20160112090629.GO6344@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20160112090629.GO6344@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Jan 2016, Peter Zijlstra wrote: >On Mon, Jan 11, 2016 at 10:22:43AM -0800, Davidlohr Bueso wrote: >> With d72da4a4d97 (rbtree: Make lockless searches non-fatal) our rbtrees >> provide weak guarantees that allows us to do lockless (and very speculative) >> reads of the tree. Such readers cannot see partial stores on nodes, ie >> left/right as well as root. As such, similar to the WRITE_ONCE semantics when >> doing rotations, use READ_ONCE when checking the root node in RB_EMPTY_ROOT. > >No objection, but is this actually used anywhere? I found this because I wanted to use the waiter check in rtmutexes in a lockless fashion (ie rt_mutex_has_waiters). > >Or is this a just-in-case completeness thing? This too. Thanks, Davidlohr