From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754139AbbKBVLY (ORCPT ); Mon, 2 Nov 2015 16:11:24 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:33637 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbbKBVLW (ORCPT ); Mon, 2 Nov 2015 16:11:22 -0500 MIME-Version: 1.0 In-Reply-To: <8722.1446496609@warthog.procyon.org.uk> References: <20151102132901.157178466@infradead.org> <20151102134941.005198372@infradead.org> <8722.1446496609@warthog.procyon.org.uk> Date: Mon, 2 Nov 2015 13:11:22 -0800 X-Google-Sender-Auth: iB7BIpXS0mnIJcy_X1TzklLhw2Y Message-ID: Subject: Re: [PATCH 4/4] locking: Introduce smp_cond_acquire() From: Linus Torvalds To: David Howells Cc: Peter Zijlstra , Ingo Molnar , Oleg Nesterov , Linux Kernel Mailing List , Paul McKenney , boqun.feng@gmail.com, Jonathan Corbet , Michal Hocko , Will Deacon Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 2, 2015 at 12:36 PM, David Howells wrote: > Linus Torvalds wrote: > >> > + smp_read_barrier_depends(); /* ctrl */ \ >> > + smp_rmb(); /* ctrl + rmb := acquire */ \ > > Doesn't smp_rmb() imply an smp_read_barrier_depends() anyway? Yes, it does. But that "smp_read_barrier_depends()" is actually mis-used as a "barrier against subsequent dependent writes, thanks to the control flow". It's not protecting against subsequent reads - which is what the smp_rmb() is about. Which is completely bogus, but that's what the comment implies. Of course, on alpha (which is where smp_read_barrier_depends() makes a difference), both that and smp_rmb() are just full memory barriers, because alpha is some crazy sh*t. So yes, a "smp_rmb()" is sufficient everywhere, but that is actually not where the confusion comes from in the first place. Linus