From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755580AbbIAJoI (ORCPT ); Tue, 1 Sep 2015 05:44:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41356 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755217AbbIAJoF (ORCPT ); Tue, 1 Sep 2015 05:44:05 -0400 Date: Tue, 1 Sep 2015 11:41:27 +0200 From: Oleg Nesterov To: "Paul E. McKenney" Cc: Boqun Feng , Michal Hocko , Peter Zijlstra , LKML , David Howells , Linus Torvalds , Jonathan Corbet Subject: Re: wake_up_process implied memory barrier clarification Message-ID: <20150901094127.GA31368@redhat.com> References: <20150827124334.GY16853@twins.programming.kicks-ass.net> <20150827131444.GE27052@dhcp22.suse.cz> <20150827182654.GA12191@redhat.com> <20150828145121.GG5301@dhcp22.suse.cz> <20150828160637.GA4393@redhat.com> <20150829092514.GA3240@fixme-laptop.cn.ibm.com> <20150829142707.GA19263@redhat.com> <20150831003719.GC924@fixme-laptop.cn.ibm.com> <20150831183335.GA26333@redhat.com> <20150831203739.GX4029@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150831203739.GX4029@linux.vnet.ibm.com> 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 On 08/31, Paul E. McKenney wrote: > > On Mon, Aug 31, 2015 at 08:33:35PM +0200, Oleg Nesterov wrote: > > On 08/31, Boqun Feng wrote: > > > > > > Fair enough, I went too far. How about just a single paragraph saying > > > that: > > > > > > The wake_up(), wait_event() and their friends have proper barriers in > > > them, but these implicity barriers are only for the correctness for > > > sleep and wakeup. So don't rely on these barriers for things that are > > > neither wait-conditons nor task states. > > > > > > Is that OK to you? > > > > Ask Paul ;) but personally I agree. > > > > To me, the only thing a user should know about wake_up/try_to_wake_up > > and barriers is that you do not need another barrier between setting > > condition and waking up. > > Sounds like an excellent idea in general. But could you please show me > a short code snippet illustrating where you don't need the additional > barrier, even if the fastpaths are taken so that there is no sleep and > no wakeup? I guess I wasn't clear... All I tried to say is that CONDITION = 1; wake_up_process(); does not need any _additional_ barrier in between. I mentioned this because afaics people are often unsure if this is true or not, and to some degree this question initiated this discussion. Oleg.