lkml.org 
[lkml]   [2013]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC][PATCH 3/2] x86/jump labels: Count and display the short jumps used
From
Date
On Wed, 2013-08-07 at 13:36 -0400, Steven Rostedt wrote:
> As I said, I would post the patches that let the jmps used by jump labels
> be turn to 2 bytes where possible. These are a bit controversial due
> to the complexity of the update_jump_label code.
>
> These patches are based off of tip's x86/jumplabel code.
>
> But if someone cares to play with it, feel free. I'll push this up
> to my repo under: tip/perf/jump-label-7 (internally this is my 7th version).
>
> I'll post a patch that does the counting as well as a reply to this
> post.

Here's the patch that forces the update and counts the number of short
jumps vs long jumps. It also outputs the locations of the short jumps.

On another box, using a distro config, I had even better results:

[ 2.352448] short jumps: 193
[ 2.355407] long jumps: 219

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Index: linux-trace.git/arch/x86/kernel/jump_label.c
===================================================================
--- linux-trace.git.orig/arch/x86/kernel/jump_label.c
+++ linux-trace.git/arch/x86/kernel/jump_label.c
@@ -44,6 +44,9 @@ static void bug_at(unsigned char *ip, in
BUG();
}

+static int short_nops;
+static int long_nops;
+
static void __jump_label_transform(struct jump_entry *entry,
enum jump_label_type type,
void *(*poker)(void *, const void *, size_t),
@@ -82,9 +85,14 @@ static void __jump_label_transform(struc
*/
if (init) {
/* Ignore short nops, we do not change them */
- if (memcmp(ip, nop_short, 2) == 0)
+ if (memcmp(ip, nop_short, 2) == 0) {
+ short_nops++;
+ printk("short jump at: %pS %p\n",
+ (void *)ip, (void *)ip);
return;
+ }

+ long_nops++;
/* We are initializing from the default nop */
if (unlikely(memcmp(ip, default_nop, 5) != 0))
bug_at(ip, __LINE__);
@@ -154,7 +162,7 @@ __init_or_module void arch_jump_label_tr
if (jlstate == JL_STATE_START) {
const unsigned char *ideal_nop = ideal_nops[NOP_ATOMIC5];

- if (memcmp(ideal_nop, default_nop, 5) != 0)
+ if (1 || memcmp(ideal_nop, default_nop, 5) != 0)
jlstate = JL_STATE_UPDATE;
else
jlstate = JL_STATE_NO_UPDATE;
@@ -162,4 +170,11 @@ __init_or_module void arch_jump_label_tr
if (jlstate == JL_STATE_UPDATE)
__jump_label_transform(entry, type, text_poke_early, 1);
}
+
+static __init int output_jumps(void)
+{
+ printk("short jumps: %d\n", short_nops);
+ printk(" long jumps: %d\n", long_nops);
+}
+late_initcall(output_jumps);
#endif



\
 
 \ /
  Last update: 2013-08-07 21:21    [W:0.496 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site