jump-label: initialize jump-label subsystem much earlier
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Wed, 12 Oct 2011 23:17:54 +0000 (16:17 -0700)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Tue, 25 Oct 2011 18:55:15 +0000 (11:55 -0700)
Initialize jump_labels much, much earlier, so they're available for use
during system setup.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
include/linux/jump_label.h
init/main.c
kernel/jump_label.c

index 56594e45b0117f3ace5256f10c9bcf0a4dd5367e..388b0d425b507add656cca2aa7b48a346bf159ec 100644 (file)
@@ -16,7 +16,7 @@ struct jump_label_key {
 
 # include <asm/jump_label.h>
 # define HAVE_JUMP_LABEL
-#endif
+#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
 
 enum jump_label_type {
        JUMP_LABEL_DISABLE = 0,
@@ -41,6 +41,7 @@ static __always_inline bool static_branch(struct jump_label_key *key)
 extern struct jump_entry __start___jump_table[];
 extern struct jump_entry __stop___jump_table[];
 
+extern void jump_label_init(void);
 extern void jump_label_lock(void);
 extern void jump_label_unlock(void);
 extern void arch_jump_label_transform(struct jump_entry *entry,
@@ -53,7 +54,7 @@ extern void jump_label_dec(struct jump_label_key *key);
 extern bool jump_label_enabled(struct jump_label_key *key);
 extern void jump_label_apply_nops(struct module *mod);
 
-#else
+#else  /* !HAVE_JUMP_LABEL */
 
 #include <linux/atomic.h>
 
@@ -63,6 +64,10 @@ struct jump_label_key {
        atomic_t enabled;
 };
 
+static __always_inline void jump_label_init(void)
+{
+}
+
 static __always_inline bool static_branch(struct jump_label_key *key)
 {
        if (unlikely(atomic_read(&key->enabled)))
@@ -97,7 +102,6 @@ static inline int jump_label_apply_nops(struct module *mod)
 {
        return 0;
 }
+#endif /* HAVE_JUMP_LABEL */
 
-#endif
-
-#endif
+#endif /* _LINUX_JUMP_LABEL_H */
index 2a9b88aa5e7601f83031ed5623dbbb25742dad30..29d8d847de9499ebb9fe1a601f5a5ec1eb8cbf58 100644 (file)
@@ -515,6 +515,9 @@ asmlinkage void __init start_kernel(void)
        parse_args("Booting kernel", static_command_line, __start___param,
                   __stop___param - __start___param,
                   &unknown_bootoption);
+
+       jump_label_init();
+
        /*
         * These use large bootmem allocations and must precede
         * kmem_cache_init()
index ff2028f35aa8c5cbb58ab4a8e61e614ecfb51368..bbdfe2a462a088b210d5792c674b215274b1b39b 100644 (file)
@@ -133,7 +133,7 @@ static void __jump_label_update(struct jump_label_key *key,
        }
 }
 
-static __init int jump_label_init(void)
+void __init jump_label_init(void)
 {
        struct jump_entry *iter_start = __start___jump_table;
        struct jump_entry *iter_stop = __stop___jump_table;
@@ -159,10 +159,7 @@ static __init int jump_label_init(void)
 #endif
        }
        jump_label_unlock();
-
-       return 0;
 }
-early_initcall(jump_label_init);
 
 #ifdef CONFIG_MODULES