From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754744AbbIRPdL (ORCPT ); Fri, 18 Sep 2015 11:33:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48009 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbbIRPdJ (ORCPT ); Fri, 18 Sep 2015 11:33:09 -0400 Date: Fri, 18 Sep 2015 17:30:12 +0200 From: Oleg Nesterov To: Peter Zijlstra Cc: Dmitry Vyukov , ebiederm@xmission.com, Al Viro , Andrew Morton , Ingo Molnar , Paul McKenney , mhocko@suse.cz, LKML , ktsan@googlegroups.com, Kostya Serebryany , Andrey Konovalov , Alexander Potapenko , Hans Boehm Subject: Re: [PATCH] kernel: fix data race in put_pid Message-ID: <20150918153012.GA15521@redhat.com> References: <1442496268-47803-1-git-send-email-dvyukov@google.com> <20150917160837.GA26050@redhat.com> <20150917174456.GA30178@redhat.com> <20150917180919.GA32116@redhat.com> <20150918085156.GS3816@twins.programming.kicks-ass.net> <20150918132844.GA10241@redhat.com> <20150918134630.GW3816@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150918134630.GW3816@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I can't resist. You certainly don't need this spam, but On 09/18, Peter Zijlstra wrote: > > On Fri, Sep 18, 2015 at 03:28:44PM +0200, Oleg Nesterov wrote: > > > > And again, I simply can't understand if this code > > > > if (READ_ONCE_CTRL(Y)) > > BUG_ON(X == 0); > > > > to me it does _not_ look correct in theory. > > So control dependencies provide a load-store barrier. Your examples > above rely on a load-load barrier; BUG_ON(X == 0) is a load. Yes, and this is just obvious. Yet I was confused because reading other emails I misunderstood the proposed semantics of atomic_read_ctrl(), so I started to suspect that in fact _CTRL() does more than I used to think. Nevermind, sorry for noise, thanks to all. Oleg.