Re: [PATCH v3] jump_label: reduce the size of struct static_key

From: Steven Rostedt
Date: Wed Feb 01 2017 - 13:51:13 EST


On Tue, 31 Jan 2017 17:00:43 -0500
Jason Baron <jbaron@xxxxxxxxxx> wrote:

> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -236,12 +236,27 @@ void __weak __init_or_module arch_jump_label_transform_static(struct jump_entry
>
> static inline struct jump_entry *static_key_entries(struct static_key *key)
> {
> - return (struct jump_entry *)((unsigned long)key->entries & ~JUMP_TYPE_MASK);

I wonder if we should add:

WARN_ON_ONCE(key->type & JUMP_TYPE_LINKED);

> + return (struct jump_entry *)(key->type & ~JUMP_TYPE_MASK);
> }
>

[...]

>
> +static inline struct static_key_mod *static_key_mod(struct static_key *key)
> +{

WARN_ON_ONCE(!(key->type & JUMP_TYPE_LINKED));

> + return (struct static_key_mod *)(key->type & ~JUMP_TYPE_MASK);
> +}
> +

-- Steve