From patchwork Fri Jun 15 20:13:05 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: 9336 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 A719D23E5A for ; Fri, 15 Jun 2012 20:13:31 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 70DB2A18368 for ; Fri, 15 Jun 2012 20:13:31 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so3061900yhp.11 for ; Fri, 15 Jun 2012 13:13:31 -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=CyLH9WEVi6L2pQIA+rr5Umo3lIKXJZ14uHzt71e6eCE=; b=XHijCvsdo9Ri1HmrcyxlRAofsOZjpT063J4KreCLh3dyfdtzdpS29+9PqATJmXlHI8 MBeAm+3vlz1Zh/wIXLEmzeo8qi6V+lvnv2E7rWmDe0fBuK9c64dvwsqbkMkvKZHrJ9L8 bqjjp1WLqUkEtWO0CsOMO/uYL+5aCJLYLswUKePZJlxYvl/kBbbgF9Jxtzu3ObGSHuR0 k/UmMi2xkW3uw7+9er54HXAr+3UR4+BjMLkS5R0zJKdOyeCX008eXktYyeI2T7N9H1kr CZX2AM4pCDqHQWqGlzEZ+Cd9mPrdAXP8HhLIltfAiTXKqaRWvwNFUafIa8WHmBB5YDsu jThQ== Received: by 10.50.160.198 with SMTP id xm6mr3277830igb.0.1339791211073; Fri, 15 Jun 2012 13:13:31 -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 v20csp167534ibb; Fri, 15 Jun 2012 13:13:30 -0700 (PDT) Received: by 10.68.234.35 with SMTP id ub3mr24251670pbc.8.1339791210429; Fri, 15 Jun 2012 13:13:30 -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 mo5si762496pbc.328.2012.06.15.13.13.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jun 2012 13:13:30 -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, 15 Jun 2012 14:13:29 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 15 Jun 2012 14:13:26 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id F22063E40048 for ; Fri, 15 Jun 2012 20:13:24 +0000 (WET) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5FKDOik196494 for ; Fri, 15 Jun 2012 14:13:24 -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 q5FKDIad015489 for ; Fri, 15 Jun 2012 14:13:21 -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 q5FKDIIF015466; Fri, 15 Jun 2012 14:13:18 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 34538E719F; 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 04/14] rcu: Add a gcc-style structure initializer for RCU pointers Date: Fri, 15 Jun 2012 13:13:05 -0700 Message-Id: <1339791195-26389-4-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-7408-0000-0000-000005E49149 X-Gm-Message-State: ALoCoQnSk1vfAeu/uyLmQT4UCW7fLUOZOQp1UhoZX23InHDk8oQEc+zjQops3uvnU9o09dvOA9DX From: "Paul E. McKenney" RCU_INIT_POINTER() returns a value that is never used, and which should be abolished due to terminal ugliness: q = RCU_INIT_POINTER(global_p, p); However, there are two uses that cannot be handled by a do-while formulation because they do gcc-style initialization: RCU_INIT_POINTER(.real_cred, &init_cred), RCU_INIT_POINTER(.cred, &init_cred), This usage is clever, but not necessarily the nicest approach. This commit therefore creates an INIT_RCU_POINTER() macro that is specifically designed for gcc-style initialization. Signed-off-by: Paul E. McKenney --- include/linux/rcupdate.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 26d1a47..eb92c21 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -906,6 +906,14 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) #define RCU_INIT_POINTER(p, v) \ p = (typeof(*v) __force __rcu *)(v) +/** + * INIT_RCU_POINTER() - statically initialize an RCU protected pointer + * + * GCC-style initialization for an RCU-protected pointer in a structure field. + */ +#define INIT_RCU_POINTER(p, v) \ + .p = (typeof(*v) __force __rcu *)(v) + static __always_inline bool __is_kfree_rcu_offset(unsigned long offset) { return offset < 4096;