Commit ac99b862fb98a36929831791da31714f709c2aa8

Authored by Peter Zijlstra
Committed by Ingo Molnar
1 parent 9cdbe1cbac

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>

Showing 2 changed files with 11 additions and 4 deletions Side-by-side Diff

include/linux/jump_label.h
... ... @@ -128,5 +128,8 @@
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 */
... ... @@ -248,8 +248,13 @@
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)
... ... @@ -289,8 +294,7 @@
289 294 key->next = jlm;
290 295  
291 296 if (jump_label_enabled(key))
292   - __jump_label_update(key, iter, iter_stop,
293   - JUMP_LABEL_ENABLE);
  297 + __jump_label_update(key, iter, iter_stop, JUMP_LABEL_ENABLE);
294 298 }
295 299  
296 300 return 0;