[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180507135857.7565-1-julia@ni.com>
Date: Mon, 7 May 2018 08:58:56 -0500
From: Julia Cartwright <julia@...com>
To: <bigeasy@...utronix.de>, <tglx@...utronix.de>
CC: <linux-rt-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Phillip Lougher" <phillip@...ashfs.org.uk>,
Alexander Stein <alexander.stein@...tec-electronic.com>
Subject: [PATCH RT 1/2] locallock: provide {get,put}_locked_ptr() variants
Provide a set of locallocked accessors for pointers to per-CPU data;
this is useful for dynamically-allocated per-CPU regions, for example.
These are symmetric with the {get,put}_cpu_ptr() per-CPU accessor
variants.
Signed-off-by: Julia Cartwright <julia@...com>
---
include/linux/locallock.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/locallock.h b/include/linux/locallock.h
index d658c2552601..921eab83cd34 100644
--- a/include/linux/locallock.h
+++ b/include/linux/locallock.h
@@ -222,6 +222,14 @@ static inline int __local_unlock_irqrestore(struct local_irq_lock *lv,
#define put_locked_var(lvar, var) local_unlock(lvar);
+#define get_locked_ptr(lvar, var) \
+ ({ \
+ local_lock(lvar); \
+ this_cpu_ptr(var); \
+ })
+
+#define put_locked_ptr(lvar, var) local_unlock(lvar);
+
#define local_lock_cpu(lvar) \
({ \
local_lock(lvar); \
@@ -262,6 +270,8 @@ static inline void local_irq_lock_init(int lvar) { }
#define get_locked_var(lvar, var) get_cpu_var(var)
#define put_locked_var(lvar, var) put_cpu_var(var)
+#define get_locked_ptr(lvar, var) get_cpu_ptr(var)
+#define put_locked_ptr(lvar, var) put_cpu_ptr(var)
#define local_lock_cpu(lvar) get_cpu()
#define local_unlock_cpu(lvar) put_cpu()
--
2.17.0
Powered by blists - more mailing lists