From patchwork Fri Jun 15 20:13:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 9345 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5F3E123E5A for ; Fri, 15 Jun 2012 20:13:49 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2FB64A184ED for ; Fri, 15 Jun 2012 20:13:49 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so3037748yen.11 for ; Fri, 15 Jun 2012 13:13:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=Ah6iVFbyQlmI84Z0j1foZSg7AKGBLWasmXw5EJFD95U=; b=BLAQNzuK7i8VdCKujhUxXF2uYnhHiigiqBNuM1LmuuTh0MQUnv0zNWIpqUztXqH3HO OJuhv1EwLMowmj3/FL2n9504elyVggueV1ORHbvnP2W9Rvcl/VJNKIQ1nSZ85DZiT00l gSbFvVGUUEaIPAhlNFDE1NXG71rpGbZeEaZ65HCoyfB+bo1RUBdy6o297kM4ZFAbmkSF CuknU8TxfaoZkv2tWaEDHvY7kaJfkiTtgkFwz9ktaHvyKipuiwdsRZJlLMe18hM4pDuf cVmkOpsSH0EYEZzwZy4mf40lN37aVllpHlJ7XmeNPXpbTaUJJU1LmDB8ENEYX9Cn2a+B ntbA== Received: by 10.50.203.39 with SMTP id kn7mr3168681igc.53.1339791228784; Fri, 15 Jun 2012 13:13:48 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp167564ibb; Fri, 15 Jun 2012 13:13:48 -0700 (PDT) Received: by 10.68.234.35 with SMTP id ub3mr24254188pbc.8.1339791228105; Fri, 15 Jun 2012 13:13:48 -0700 (PDT) Received: from e32.co.us.ibm.com (e32.co.us.ibm.com. [32.97.110.150]) by mx.google.com with ESMTPS id vr5si17700830pbc.343.2012.06.15.13.13.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jun 2012 13:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.150 as permitted sender) client-ip=32.97.110.150; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.150 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Jun 2012 14:13:46 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 15 Jun 2012 14:13:28 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 9CE541FF001F for ; Fri, 15 Jun 2012 20:13:27 +0000 (WET) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5FKDQ1k208600 for ; Fri, 15 Jun 2012 14:13:26 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5FKDIwD015523 for ; Fri, 15 Jun 2012 14:13:26 -0600 Received: from paulmck-ThinkPad-W500 ([9.47.24.152]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q5FKDI1O015498; Fri, 15 Jun 2012 14:13:18 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 71666E71A5; Fri, 15 Jun 2012 13:13:18 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com, patches@linaro.org, "Paul E. McKenney" Subject: [PATCH tip/core/rcu 08/14] rcu: Remove return value from rcu_assign_pointer() Date: Fri, 15 Jun 2012 13:13:09 -0700 Message-Id: <1339791195-26389-8-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1339791195-26389-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120615201256.GA26120@linux.vnet.ibm.com> <1339791195-26389-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12061520-3270-0000-0000-000007370AA5 X-Gm-Message-State: ALoCoQn2QMG1Lx5QfkAMCuguBY0N8CYLw3JeRZZOr5Oz988iXBxJKFH63hhdehATu2jU8G24cln8 From: "Paul E. McKenney" The return value from rcu_assign_pointer() is not used, and using it would be quite ugly, for example: q = rcu_assign_pointer(global_p, p); To prevent this sort of ugliness from spreading, this commit wraps rcu_assign_pointer() in a do-while loop. Reported-by: Mathieu Desnoyers Reported-by: Josh Triplett Signed-off-by: Paul E. McKenney Reviewed-by: Josh Triplett --- include/linux/rcupdate.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index f2cca02..2f6ec55 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -514,10 +514,10 @@ static inline void rcu_preempt_sleep_check(void) (_________p1); \ }) #define __rcu_assign_pointer(p, v, space) \ - ({ \ + do { \ smp_wmb(); \ (p) = (typeof(*v) __force space *)(v); \ - }) + } while (0) /** @@ -852,7 +852,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) * * Assigns the specified value to the specified RCU-protected * pointer, ensuring that any concurrent RCU readers will see - * any prior initialization. Returns the value assigned. + * any prior initialization. * * Inserts memory barriers on architectures that require them * (which is most of them), and also prevents the compiler from