lkml.org 
[lkml]   [2017]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] jump_label: reduce the size of struct static_key
On Tue, 31 Jan 2017 17:00:43 -0500
Jason Baron <jbaron@akamai.com> 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

\
 
 \ /
  Last update: 2017-02-01 19:51    [W:0.036 / U:3.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site