[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-1ca3398278341e1db3568f2d9c015ee4f5ad0b56@git.kernel.org>
Date: Fri, 19 Apr 2019 11:40:33 -0700
From: tip-bot for Daniel Bristot de Oliveira <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: jkosina@...e.cz, acme@...hat.com, crecklin@...hat.com,
bristot@...hat.com, jolsa@...hat.com, tglx@...utronix.de,
torvalds@...ux-foundation.org, swood@...hat.com, jbaron@...mai.com,
hpa@...or.com, bp@...en8.de, dvlasenk@...hat.com,
rostedt@...dmis.org, luto@...nel.org, mhiramat@...nel.org,
alexander.shishkin@...ux.intel.com, gregkh@...uxfoundation.org,
brgerst@...il.com, linux-kernel@...r.kernel.org, mingo@...nel.org,
jpoimboe@...hat.com, williams@...hat.com, peterz@...radead.org,
mtosatti@...hat.com
Subject: [tip:x86/alternatives] jump_label: Sort entries of the same key by
the code
Commit-ID: 1ca3398278341e1db3568f2d9c015ee4f5ad0b56
Gitweb: https://git.kernel.org/tip/1ca3398278341e1db3568f2d9c015ee4f5ad0b56
Author: Daniel Bristot de Oliveira <bristot@...hat.com>
AuthorDate: Fri, 21 Dec 2018 11:27:31 +0100
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 19 Apr 2019 19:37:34 +0200
jump_label: Sort entries of the same key by the code
In the batching mode, entries with the same key should also be sorted by the
code, enabling a bsearch() of a code/addr when updating a key.
Signed-off-by: Daniel Bristot de Oliveira <bristot@...hat.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Chris von Recklinghausen <crecklin@...hat.com>
Cc: Clark Williams <williams@...hat.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Jason Baron <jbaron@...mai.com>
Cc: Jiri Kosina <jkosina@...e.cz>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Marcelo Tosatti <mtosatti@...hat.com>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Scott Wood <swood@...hat.com>
Cc: Steven Rostedt (VMware) <rostedt@...dmis.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/7006ec86c40e5ec5d546dcd76ccc42d46079a963.1545228276.git.bristot@redhat.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/jump_label.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 456c0d7cbb5b..53b7c85c0b09 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -36,12 +36,28 @@ static int jump_label_cmp(const void *a, const void *b)
const struct jump_entry *jea = a;
const struct jump_entry *jeb = b;
+ /*
+ * Entrires are sorted by key.
+ */
if (jump_entry_key(jea) < jump_entry_key(jeb))
return -1;
if (jump_entry_key(jea) > jump_entry_key(jeb))
return 1;
+#ifdef HAVE_JUMP_LABEL_BATCH
+ /*
+ * In the batching mode, entries should also be sorted by the code
+ * inside the already sorted list of entries, enabling a bsearch in
+ * the vector.
+ */
+ if (jump_entry_code(jea) < jump_entry_code(jeb))
+ return -1;
+
+ if (jump_entry_code(jea) > jump_entry_code(jeb))
+ return 1;
+#endif
+
return 0;
}
Powered by blists - more mailing lists