linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: linux-kernel@vger.kernel.org, mingo@kernel.org
Cc: jasonbaron0@gmail.com, bp@alien8.de, luto@amacapital.net,
	tglx@linutronix.de, rostedt@goodmis.org, will.deacon@arm.com,
	liuj97@gmail.com, rabin@rab.in, ralf@linux-mips.org,
	ddaney@caviumnetworks.com, benh@kernel.crashing.org,
	michael@ellerman.id.au, heiko.carstens@de.ibm.com,
	davem@davemloft.net, peterz@infradead.org
Subject: [RFC][PATCH 3/7] jump_label: Add jump_entry_key() helper
Date: Fri, 24 Jul 2015 19:52:12 +0200	[thread overview]
Message-ID: <20150724175822.777724757@infradead.org> (raw)
In-Reply-To: 20150724175209.814173117@infradead.org

[-- Attachment #1: peterz-static-key-jump_entry_key.patch --]
[-- Type: text/plain, Size: 1795 bytes --]

Avoid some casting with a helper, also prepares the way for
overloading the LSB of jump_entry::key.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/jump_label.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -188,6 +188,11 @@ static inline struct jump_entry *static_
 	return (struct jump_entry *)((unsigned long)key->entries & ~JUMP_TYPE_MASK);
 }
 
+static inline struct static_key *jump_entry_key(struct jump_entry *entry)
+{
+	return (struct static_key *)((unsigned long)entry->key);
+}
+
 static enum jump_label_type jump_label_type(struct static_key *key)
 {
 	bool enabled = static_key_enabled(key);
@@ -209,8 +214,8 @@ void __init jump_label_init(void)
 	for (iter = iter_start; iter < iter_stop; iter++) {
 		struct static_key *iterk;
 
-		iterk = (struct static_key *)(unsigned long)iter->key;
-		arch_jump_label_transform_static(iter, jump_label_type(iterk));
+		iterk = jump_entry_key(iter);
+		arch_jump_label_transform_static(iter, jump_label_type(iterk));
 		if (iterk == key)
 			continue;
 
@@ -304,7 +309,7 @@ static int jump_label_add_module(struct
 	for (iter = iter_start; iter < iter_stop; iter++) {
 		struct static_key *iterk;
 
-		iterk = (struct static_key *)(unsigned long)iter->key;
+		iterk = jump_entry_key(iter);
 		if (iterk == key)
 			continue;
 
@@ -341,10 +346,10 @@ static void jump_label_del_module(struct
 	struct static_key_mod *jlm, **prev;
 
 	for (iter = iter_start; iter < iter_stop; iter++) {
-		if (iter->key == (jump_label_t)(unsigned long)key)
+		if (jump_entry_key(iter) == key)
 			continue;
 
-		key = (struct static_key *)(unsigned long)iter->key;
+		key = jump_entry_key(iter);
 
 		if (within_module(iter->key, mod))
 			continue;



  parent reply	other threads:[~2015-07-24 18:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 17:52 [RFC][PATCH 0/7] jump_label: Another (better) static_key interface Peter Zijlstra
2015-07-24 17:52 ` [RFC][PATCH 1/7] jump_label: Rename JUMP_LABEL_{EN,DIS}ABLE Peter Zijlstra
2015-07-24 17:52 ` [RFC][PATCH 2/7] jump_label: Rename JUMP_LABEL_TYPE_* Peter Zijlstra
2015-07-24 17:52 ` Peter Zijlstra [this message]
2015-07-24 17:52 ` [RFC][PATCH 4/7] jump_label: Add static_key_{en,dis}able() helpers Peter Zijlstra
2015-07-24 17:52 ` [RFC][PATCH 5/7] jump_label: Rework update logic Peter Zijlstra
2015-07-27  9:07   ` Peter Zijlstra
2015-07-27 10:47   ` Peter Zijlstra
2015-07-27 16:30     ` Peter Zijlstra
2015-07-28  5:54       ` Heiko Carstens
2015-07-24 17:52 ` [RFC][PATCH 6/7] jump_label: Add a new static_key interface Peter Zijlstra
2015-07-27  9:24   ` Peter Zijlstra
2015-07-27  9:52   ` Peter Zijlstra
2015-07-27 10:20     ` Heiko Carstens
2015-07-27 10:47       ` Peter Zijlstra
2015-07-27 10:50         ` Peter Zijlstra
2015-07-27 10:52           ` Heiko Carstens
2015-07-27 11:03             ` Peter Zijlstra
2015-07-27 14:39             ` Peter Zijlstra
2015-07-27 10:45   ` Peter Zijlstra
2015-07-27 10:51     ` Heiko Carstens
2015-07-24 17:52 ` [RFC][PATCH 7/7] x86, tsc: Employ static_branch_likely() Peter Zijlstra

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=20150724175822.777724757@infradead.org \
    --to=peterz@infradead.org \
    --cc=benh@kernel.crashing.org \
    --cc=bp@alien8.de \
    --cc=davem@davemloft.net \
    --cc=ddaney@caviumnetworks.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jasonbaron0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuj97@gmail.com \
    --cc=luto@amacapital.net \
    --cc=michael@ellerman.id.au \
    --cc=mingo@kernel.org \
    --cc=rabin@rab.in \
    --cc=ralf@linux-mips.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /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).