Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jump_label: Provide jump_label_key initializers

Provide two initializers for jump_label_key that initialize it enabled
or disabled. Also modify all jump_label code to allow for jump_labels to be
initialized enabled.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jason Baron <jbaron@redhat.com>
Link: http://lkml.kernel.org/n/tip-p40e3yj21b68y03z1yv825e7@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Peter Zijlstra and committed by
Ingo Molnar
ac99b862 9cdbe1cb

+11 -4
+3
include/linux/jump_label.h
··· 128 128 } 129 129 #endif /* HAVE_JUMP_LABEL */ 130 130 131 + #define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), }) 132 + #define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), }) 133 + 131 134 #endif /* _LINUX_JUMP_LABEL_H */
+8 -4
kernel/jump_label.c
··· 248 248 if (iter_start == iter_stop) 249 249 return; 250 250 251 - for (iter = iter_start; iter < iter_stop; iter++) 252 - arch_jump_label_transform_static(iter, JUMP_LABEL_DISABLE); 251 + for (iter = iter_start; iter < iter_stop; iter++) { 252 + struct jump_label_key *iterk; 253 + 254 + iterk = (struct jump_label_key *)(unsigned long)iter->key; 255 + arch_jump_label_transform_static(iter, jump_label_enabled(iterk) ? 256 + JUMP_LABEL_ENABLE : JUMP_LABEL_DISABLE); 257 + } 253 258 } 254 259 255 260 static int jump_label_add_module(struct module *mod) ··· 294 289 key->next = jlm; 295 290 296 291 if (jump_label_enabled(key)) 297 - __jump_label_update(key, iter, iter_stop, 298 - JUMP_LABEL_ENABLE); 292 + __jump_label_update(key, iter, iter_stop, JUMP_LABEL_ENABLE); 299 293 } 300 294 301 295 return 0;