lkml.org 
[lkml]   [2017]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] jump_label: reduce the size of struct static_key

* Jason Baron <jbaron@akamai.com> wrote:

> >For example the last line could sure be written as:
> >
> > key->entries = jlm->entries;
> > key->type |= static_key_type(key);
> >
> >right?
>
> Hi,
>
> So that is going to over-write the static_key_type(key) in the first
> assignment. If the order is reversed we can't just |= in the pointer type.

Indeed, I missed that.

> How about:
>
> static void jump_key_set_entries(struct static_key *key, struct jump_entry *entries)
> {
> unsigned long type;
>
> type = static_key_type(key);
> key->entries = entries;
> key->type |= type;
> }
>
> and then we can also add:
>
> void jump_key_set_mod(struct static_key *key, struct static_key_mod *mod)
>
> doing basically the same thing. That will avoid the casts that you called
> out.
>
> better?

Yeah - and it should generate the exact same code, right?

I'd also add a short comment to the helper function that points out the
union/aliasing, in case anyone is wondering.

Thanks,

Ingo

\
 
 \ /
  Last update: 2017-01-21 08:08    [W:0.449 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site