Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbdGaJFs (ORCPT ); Mon, 31 Jul 2017 05:05:48 -0400 Received: from merlin.infradead.org ([205.233.59.134]:34766 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbdGaJFp (ORCPT ); Mon, 31 Jul 2017 05:05:45 -0400 Date: Mon, 31 Jul 2017 11:05:35 +0200 From: Peter Zijlstra To: Boqun Feng Cc: Will Deacon , Paul McKenney , linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Randy Dunlap Subject: Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Message-ID: <20170731090535.rjgnoewqg7mhzr55@hirez.programming.kicks-ass.net> References: <20170609092450.jwmldgtli57ozxgq@hirez.programming.kicks-ass.net> <20170609154442.GB9236@arm.com> <20170609193604.ncw3hhgvewzc3h5u@hirez.programming.kicks-ass.net> <20170611135632.sl72klbeklelupej@tardis> <20170612144929.3wiwtbqopsfpm3qk@hirez.programming.kicks-ass.net> <20170726115328.2sxiitivlnlq64dk@hirez.programming.kicks-ass.net> <20170726124750.vktrn5zi2gmpzfru@tardis> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170726124750.vktrn5zi2gmpzfru@tardis> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 805 Lines: 30 On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > + > > +Further, while something like: > > + > > + smp_mb__before_atomic(); > > + atomic_dec(&X); > > + > > +is a 'typical' RELEASE pattern, the barrier is strictly stronger than > > +a RELEASE. Similarly for something like: > > + > > .. at here. Maybe you planned to put stronger ACQUIRE pattern? Yes, although I struggled to find a sensible one. The problem is that ACQUIRE is on loads and value returning atomics have an ACQUIRE variant, so why would you ever want to use smp_mb__after_atomic() for this. That is, the best I could come up with is something like: val = atomic_fetch_or_relaxed(1, &var); smp_mb__after_atomic(); But in that case we should've just written: val = atomic_fetch_or_acquire(1, &var); Suggestions?