From: Julia Cartwright <julia@ni.com>
To: <bigeasy@linutronix.de>, <tglx@linutronix.de>
Cc: <linux-rt-users@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Phillip Lougher" <phillip@squashfs.org.uk>,
Alexander Stein <alexander.stein@systec-electronic.com>
Subject: [PATCH RT 1/2] locallock: provide {get,put}_locked_ptr() variants
Date: Mon, 7 May 2018 08:58:56 -0500 [thread overview]
Message-ID: <20180507135857.7565-1-julia@ni.com> (raw)
In-Reply-To: <4064553.Shs7ScuBS6@ws-stein>
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@ni.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
next prev parent reply other threads:[~2018-05-07 13:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-02 13:12 [PATCH 1/1] squashfs: Disable "percpu multiple decompressor" on RT Alexander Stein
2018-05-02 14:37 ` Julia Cartwright
2018-05-03 6:36 ` Alexander Stein
2018-05-03 15:48 ` Julia Cartwright
2018-05-07 6:09 ` Alexander Stein
2018-05-07 13:58 ` Julia Cartwright [this message]
2018-05-07 13:58 ` [PATCH RT 2/2] squashfs: make use of local lock in multi_cpu decompressor Julia Cartwright
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180507135857.7565-1-julia@ni.com \
--to=julia@ni.com \
--cc=alexander.stein@systec-electronic.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=phillip@squashfs.org.uk \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).