Skip to content

Commit

Permalink
jump_label: Add jump_entry_key() helper
Browse files Browse the repository at this point in the history
Avoid some casting with a helper, also prepares the way for
overloading the LSB of jump_entry::key.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 3, 2015
1 parent a1efb01 commit 7dcfd91
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ static inline struct jump_entry *static_key_entries(struct static_key *key)
return (struct jump_entry *)((unsigned long)key->entries & ~JUMP_TYPE_MASK);
}

static inline struct static_key *jump_entry_key(struct jump_entry *entry)
{
return (struct static_key *)((unsigned long)entry->key);
}

static enum jump_label_type jump_label_type(struct static_key *key)
{
bool enabled = static_key_enabled(key);
Expand All @@ -209,7 +214,7 @@ void __init jump_label_init(void)
for (iter = iter_start; iter < iter_stop; iter++) {
struct static_key *iterk;

iterk = (struct static_key *)(unsigned long)iter->key;
iterk = jump_entry_key(iter);
arch_jump_label_transform_static(iter, jump_label_type(iterk));
if (iterk == key)
continue;
Expand Down Expand Up @@ -304,7 +309,7 @@ static int jump_label_add_module(struct module *mod)
for (iter = iter_start; iter < iter_stop; iter++) {
struct static_key *iterk;

iterk = (struct static_key *)(unsigned long)iter->key;
iterk = jump_entry_key(iter);
if (iterk == key)
continue;

Expand Down Expand Up @@ -341,10 +346,10 @@ static void jump_label_del_module(struct module *mod)
struct static_key_mod *jlm, **prev;

for (iter = iter_start; iter < iter_stop; iter++) {
if (iter->key == (jump_label_t)(unsigned long)key)
if (jump_entry_key(iter) == key)
continue;

key = (struct static_key *)(unsigned long)iter->key;
key = jump_entry_key(iter);

if (within_module(iter->key, mod))
continue;
Expand Down

0 comments on commit 7dcfd91

Please sign in to comment.