From patchwork Fri Jun 22 15:35:03 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: 9566 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 D727523E55 for ; Fri, 22 Jun 2012 15:35:39 +0000 (UTC) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by fiordland.canonical.com (Postfix) with ESMTP id 91C1AA188F3 for ; Fri, 22 Jun 2012 15:35:39 +0000 (UTC) Received: by yhjj63 with SMTP id j63so1929098yhj.37 for ; Fri, 22 Jun 2012 08:35:39 -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=7zE4neQAm7u4j9z6gsh2vnst2NwYmXXa7+6ETZGUmEM=; b=OuoTKIMIwNvO4eFx22bGmRXWW1KDLPOQZGq/j0yBbA0aROyWeqX9ew/BKCmA1jCtXd U4lR9StF+P1aGTmIOuTqFGoZToTlDxOSNtnYu9Tqcw2FZA0cfvM0Jm19ms2DxSnZcIbd rLKg4vwOV4Z3KvajopdIgmFpY4M7Tm4SItbc/8AkfmqH/PJYs3opFC66huOtBZ33joG8 kzKcICAz1odqblhIuZsVr8Ym2/8NgxHojYakdPBaooujKlgeudn+6/KS8bIP7VlrxodH AgqPEUH88ZvLK6MW4X+A3CLin6GQPcKgBByIwkHPP8y/IvTGU1W16gmjmcBHDolIh/l7 m7fA== Received: by 10.42.155.73 with SMTP id t9mr369699icw.48.1340379335444; Fri, 22 Jun 2012 08:35:35 -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 v20csp72317ibb; Fri, 22 Jun 2012 08:35:31 -0700 (PDT) Received: by 10.68.225.42 with SMTP id rh10mr11179194pbc.116.1340379331494; Fri, 22 Jun 2012 08:35:31 -0700 (PDT) Received: from e37.co.us.ibm.com (e37.co.us.ibm.com. [32.97.110.158]) by mx.google.com with ESMTPS id gk9si10121677pbc.8.2012.06.22.08.35.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 08:35:31 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.158 as permitted sender) client-ip=32.97.110.158; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.158 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jun 2012 09:35:28 -0600 Received: from d01dlp03.pok.ibm.com (9.56.224.17) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Jun 2012 09:35:26 -0600 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id D1FD9C90071 for ; Fri, 22 Jun 2012 11:35:23 -0400 (EDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5MFZOBW154220 for ; Fri, 22 Jun 2012 11:35:24 -0400 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 q5MFZFq2023162 for ; Fri, 22 Jun 2012 09:35:17 -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 q5MFZFgU023099; Fri, 22 Jun 2012 09:35:15 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 1F8E5E526A; Fri, 22 Jun 2012 08:35:15 -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, sbw@mit.edu, patches@linaro.org, "Paul E. McKenney" Subject: [PATCH tip/core/rcu 08/17] rcu: Remove return value from rcu_assign_pointer() Date: Fri, 22 Jun 2012 08:35:03 -0700 Message-Id: <1340379312-6684-8-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1340379312-6684-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120622153501.GA6626@linux.vnet.ibm.com> <1340379312-6684-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12062215-7408-0000-0000-0000061D6144 X-Gm-Message-State: ALoCoQkkvcTskLurWfJYrZV83HO1jPrm66Yb7+Ipad3sGJ3qYjoxSh1m5SiuQZaKay4ArMxg3Y69 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 267dc77..a58f382 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