Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751131AbdGLMxz (ORCPT ); Wed, 12 Jul 2017 08:53:55 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36397 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951AbdGLMxx (ORCPT ); Wed, 12 Jul 2017 08:53:53 -0400 Date: Wed, 12 Jul 2017 20:53:47 +0800 From: Boqun Feng To: Peter Zijlstra Cc: Will Deacon , Paul McKenney , linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner Subject: Re: [RFC][PATCH]: documentation,atomic: Add a new atomic_t document Message-ID: <20170712125347.xz2atyddeilhtdnd@tardis> 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ggzjwmymhndxs7tm" Content-Disposition: inline In-Reply-To: <20170612144929.3wiwtbqopsfpm3qk@hirez.programming.kicks-ass.net> 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: 1951 Lines: 56 --ggzjwmymhndxs7tm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 12, 2017 at 04:49:29PM +0200, Peter Zijlstra wrote: [...] > -Any atomic operation that modifies some state in memory and returns information > -about the state (old or new) implies an SMP-conditional general memory barrier > -(smp_mb()) on each side of the actual operation (with the exception of > -explicit lock operations, described later). These include: > - > - xchg(); > - atomic_xchg(); atomic_long_xchg(); > - atomic_inc_return(); atomic_long_inc_return(); > - atomic_dec_return(); atomic_long_dec_return(); > - atomic_add_return(); atomic_long_add_return(); > - atomic_sub_return(); atomic_long_sub_return(); > - atomic_inc_and_test(); atomic_long_inc_and_test(); > - atomic_dec_and_test(); atomic_long_dec_and_test(); > - atomic_sub_and_test(); atomic_long_sub_and_test(); > - atomic_add_negative(); atomic_long_add_negative(); > - test_and_set_bit(); > - test_and_clear_bit(); > - test_and_change_bit(); > - The bit related operations are removed from memory-barriers.txt, I think we'd better add them in atomic_t.txt? By "them", I mean: test_and_{set,clear,change}_bit() as RMW atomic {set,clear,change}_bit() as non-RMW atomic test_and_set_bit_lock() clear_bit_unlock() as non-RMW(but barrier-like) atomic Regards, Boqun --ggzjwmymhndxs7tm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAllmG9UACgkQSXnow7UH +rgkggf/eUNVkeRPo7cgw5IYHdhuJePxrmv8JN35elSv8nCu4+8FJMRDx2yrHsSd hoTLZn2mO1CTCqIbM1hhVVGLFVvmFF2nQivMewN32PGVGOE4Nab6qFV15+eypmV1 /D4d11fGhr0h/3RUvgRNNEm7QK3MFgs2684x2ty7N9E13NKMsPdtm4c0ha2j0dP/ NLIXfAix15WjR/46+ZY0sDVEc1mO0vccSu0KYN7MdXUNeorMH6Ncg43CCow4Tt9C deh+RqWyuhHAGCCkwcay749T0CHl4LlMI7gwIUr8dVvND+c/VJu6pUF6co44fw7D 4dQAG08qXZiu3yj7rUBKMYvDSTrL6A== =/7jG -----END PGP SIGNATURE----- --ggzjwmymhndxs7tm--