OSDN Git Service

jump_label: Add branch hints to static_branch_{un,}likely()
authorPeter Zijlstra <peterz@infradead.org>
Thu, 18 Jan 2018 13:38:11 +0000 (14:38 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 6 Feb 2018 09:28:57 +0000 (10:28 +0100)
For some reason these were missing, I've not observed this patch
making a difference in the few code locations I checked, but this
makes sense.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/jump_label.h

index e0340ca..b6a29c1 100644 (file)
@@ -393,7 +393,7 @@ extern bool ____wrong_branch_error(void);
                branch = !arch_static_branch_jump(&(x)->key, true);             \
        else                                                                    \
                branch = ____wrong_branch_error();                              \
-       branch;                                                                 \
+       likely(branch);                                                         \
 })
 
 #define static_branch_unlikely(x)                                              \
@@ -405,7 +405,7 @@ extern bool ____wrong_branch_error(void);
                branch = arch_static_branch(&(x)->key, false);                  \
        else                                                                    \
                branch = ____wrong_branch_error();                              \
-       branch;                                                                 \
+       unlikely(branch);                                                       \
 })
 
 #else /* !HAVE_JUMP_LABEL */