From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,URIBL_DBL_ABUSE_MALW autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A742BC35247 for ; Tue, 4 Feb 2020 01:34:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6D2D021741 for ; Tue, 4 Feb 2020 01:34:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="o2/OdlfB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D2D021741 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1E2766B026E; Mon, 3 Feb 2020 20:34:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 16B386B026F; Mon, 3 Feb 2020 20:34:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 037A16B0270; Mon, 3 Feb 2020 20:34:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0220.hostedemail.com [216.40.44.220]) by kanga.kvack.org (Postfix) with ESMTP id DF9C96B026E for ; Mon, 3 Feb 2020 20:34:31 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7F851180AD802 for ; Tue, 4 Feb 2020 01:34:31 +0000 (UTC) X-FDA: 76450724742.03.crown74_a5ce4c73674f X-HE-Tag: crown74_a5ce4c73674f X-Filterd-Recvd-Size: 4136 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Tue, 4 Feb 2020 01:34:31 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2910C21744; Tue, 4 Feb 2020 01:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580780070; bh=IZL8ey2LOshXt9KcHg2k3im6erIvetKVO2DZ4gX24PE=; h=Date:From:To:Subject:In-Reply-To:From; b=o2/OdlfBaaLjj7ZAKg0eXdNdS8uMMXvinK4jZm4k0hNONZDrlUli6+w4lg4hTaiGQ de7kxtua6KzYLVfxS0EmNNW3WTAl2w9fdGPkw8KUEJe7Gvu/nBBHSdH0JXu4gR2KRo uRdfqZx8u8mukxEZ0jzL0nLREh1kbpAy7eFS6NPU= Date: Mon, 03 Feb 2020 17:34:29 -0800 From: Andrew Morton To: 1vier1@web.de, akpm@linux-foundation.org, dave@stgolabs.net, linux-mm@kvack.org, longman@redhat.com, manfred@colorfullife.com, mm-commits@vger.kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, will.deacon@arm.com Subject: [patch 14/67] smp_mb__{before,after}_atomic(): update Documentation Message-ID: <20200204013429.YXpFLeECL%akpm@linux-foundation.org> In-Reply-To: <20200203173311.6269a8be06a05e5a4aa08a93@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Manfred Spraul Subject: smp_mb__{before,after}_atomic(): update Documentation When adding the _{acquire|release|relaxed}() variants of some atomic operations, it was forgotten to update Documentation/memory_barrier.txt: smp_mb__{before,after}_atomic() is now intended for all RMW operations that do not imply a memory barrier. 1) smp_mb__before_atomic(); atomic_add(); 2) smp_mb__before_atomic(); atomic_xchg_relaxed(); 3) smp_mb__before_atomic(); atomic_fetch_add_relaxed(); Invalid would be: smp_mb__before_atomic(); atomic_set(); In addition, the patch splits the long sentence into multiple shorter sentences. Link: http://lkml.kernel.org/r/20191020123305.14715-2-manfred@colorfullife.com Fixes: 654672d4ba1a ("locking/atomics: Add _{acquire|release|relaxed}() variants of some atomic operations") Signed-off-by: Manfred Spraul Acked-by: Waiman Long Cc: Davidlohr Bueso Cc: Peter Zijlstra Cc: Will Deacon Cc: Peter Zijlstra Cc: <1vier1@web.de> Signed-off-by: Andrew Morton --- Documentation/memory-barriers.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/Documentation/memory-barriers.txt~smp_mb__beforeafter_atomic-update-documentation +++ a/Documentation/memory-barriers.txt @@ -1868,12 +1868,16 @@ There are some more advanced barrier fun (*) smp_mb__before_atomic(); (*) smp_mb__after_atomic(); - These are for use with atomic (such as add, subtract, increment and - decrement) functions that don't return a value, especially when used for - reference counting. These functions do not imply memory barriers. + These are for use with atomic RMW functions that do not imply memory + barriers, but where the code needs a memory barrier. Examples for atomic + RMW functions that do not imply are memory barrier are e.g. add, + subtract, (failed) conditional operations, _relaxed functions, + but not atomic_read or atomic_set. A common example where a memory + barrier may be required is when atomic ops are used for reference + counting. - These are also used for atomic bitop functions that do not return a - value (such as set_bit and clear_bit). + These are also used for atomic RMW bitop functions that do not imply a + memory barrier (such as set_bit and clear_bit). As an example, consider a piece of code that marks an object as being dead and then decrements the object's reference count: _