From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by kanga.kvack.org (Postfix) with ESMTP id 71DC26B0036 for ; Tue, 13 May 2014 14:58:35 -0400 (EDT) Received: by mail-ee0-f48.google.com with SMTP id e49so696709eek.7 for ; Tue, 13 May 2014 11:58:34 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTP id o49si13827456eef.218.2014.05.13.11.58.33 for ; Tue, 13 May 2014 11:58:34 -0700 (PDT) Date: Tue, 13 May 2014 20:57:42 +0200 From: Oleg Nesterov Subject: Re: [PATCH 19/19] mm: filemap: Avoid unnecessary barries and waitqueue lookups in unlock_page fastpath Message-ID: <20140513185742.GD12123@redhat.com> References: <1399974350-11089-1-git-send-email-mgorman@suse.de> <1399974350-11089-20-git-send-email-mgorman@suse.de> <20140513125313.GR23991@suse.de> <20140513141748.GD2485@laptop.programming.kicks-ass.net> <20140513152719.GF18164@linux.vnet.ibm.com> <20140513154435.GG2485@laptop.programming.kicks-ass.net> <20140513161418.GH18164@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140513161418.GH18164@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: "Paul E. McKenney" Cc: Peter Zijlstra , Mel Gorman , Andrew Morton , Johannes Weiner , Vlastimil Babka , Jan Kara , Michal Hocko , Hugh Dickins , Dave Hansen , Linux Kernel , Linux-MM , Linux-FSDevel , Linus Torvalds , David Howells On 05/13, Paul E. McKenney wrote: > > On Tue, May 13, 2014 at 05:44:35PM +0200, Peter Zijlstra wrote: > > > > Ah, yes, so I'll defer to Oleg and Linus to explain that one. As per the > > name: smp_mb__before_spinlock() should of course imply a full barrier. > > How about if I queue a name change to smp_wmb__before_spinlock()? I agree, this is more accurate, simply because it describes what it actually does. But just in case, as for try_to_wake_up() it does not actually need wmb() between "CONDITION = T" and "task->state = RUNNING". It would be fine if these 2 STORE's are re-ordered, we can rely on rq->lock. What it actually needs is a barrier between "CONDITION = T" and "task->state & state" check. But since we do not have a store-load barrier, wmb() was added to ensure that "CONDITION = T" can't leak into the critical section. But it seems that set_tlb_flush_pending() already assumes that it acts as wmb(), so probably smp_wmb__before_spinlock() is fine. Oleg. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org