From: Peter Zijlstra <peterz@infradead.org>
To: Jason Baron <jbaron@redhat.com>
Cc: hpa@zytor.com, mathieu.desnoyers@polymtl.ca, rostedt@goodmis.org,
mingo@elte.hu, tglx@linutronix.de, andi@firstfloor.org,
roland@redhat.com, rth@redhat.com,
masami.hiramatsu.pt@hitachi.com, fweisbec@gmail.com,
avi@redhat.com, davem@davemloft.net, sam@ravnborg.org,
ddaney@caviumnetworks.com, michael@ellerman.id.au,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] jump label: introduce static_branch() interface
Date: Wed, 23 Feb 2011 11:08:04 +0100 [thread overview]
Message-ID: <1298455684.2217.352.camel@twins> (raw)
In-Reply-To: <201102222228.p1MMSxnT016454@int-mx10.intmail.prod.int.phx2.redhat.com>
On Tue, 2011-02-22 at 17:28 -0500, Jason Baron wrote:
>
> Define:
>
> struct jump_label_key jump_key;
>
> Can be used as:
>
> if (static_branch(&jump_key))
> do unlikely code
>
> enable/disale via:
>
> jump_label_enable(&jump_key);
> jump_label_disable(&jump_key);
>
> that's it!
I think you'll find jump_label_{inc,dec}() works better ;-)
Also the below cleans up a comment, flips a conditional so that we dno't
evaluate kernel_text_address() for entries we already know are dead and
uses notifier_from_errno() so as not to confuse the notifier code.
---
Index: linux-2.6/kernel/jump_label.c
===================================================================
--- linux-2.6.orig/kernel/jump_label.c
+++ linux-2.6/kernel/jump_label.c
@@ -108,10 +108,12 @@ static void __jump_label_update(struct j
struct jump_entry *entry, int enable)
{
for (; entry->key == (jump_label_t)(unsigned long)key; entry++) {
- /* entry->code set to 0 invalidates module init text sections
- * kernel_text_address() verifies we are not in core kernel init
- * code */
- if (kernel_text_address(entry->code) && entry->code)
+ /*
+ * entry->code set to 0 invalidates module init text sections
+ * kernel_text_address() verifies we are not in core kernel
+ * init code, see jump_label_invalidate_module_init().
+ */
+ if (entry->code && kernel_text_address(entry->code))
arch_jump_label_transform(entry, enable);
}
}
@@ -315,7 +317,8 @@ jump_label_module_notify(struct notifier
jump_label_unlock();
break;
}
- return ret;
+
+ return notifier_from_errno(ret);
}
struct notifier_block jump_label_module_nb = {
next prev parent reply other threads:[~2011-02-23 10:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 22:28 [PATCH] jump label: introduce static_branch() interface Jason Baron
2011-02-22 23:12 ` Andi Kleen
2011-02-23 10:08 ` Peter Zijlstra [this message]
2011-02-23 10:11 ` Peter Zijlstra
2011-02-23 13:45 ` Steven Rostedt
2011-02-23 15:48 ` Jason Baron
2011-02-23 15:40 ` Steven Rostedt
2011-02-23 15:42 ` Peter Zijlstra
2011-02-23 17:12 ` David Daney
2011-03-01 15:28 ` Mathieu Desnoyers
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=1298455684.2217.352.camel@twins \
--to=peterz@infradead.org \
--cc=andi@firstfloor.org \
--cc=avi@redhat.com \
--cc=davem@davemloft.net \
--cc=ddaney@caviumnetworks.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=michael@ellerman.id.au \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=rostedt@goodmis.org \
--cc=rth@redhat.com \
--cc=sam@ravnborg.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.