Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1563339
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] jump_label: reduce the size of struct static_key |
| Date | 2017-01-20 08:30 +0100 |
| Message-ID | <t1BO1-4ji-1@gated-at.bofh.it> (permalink) |
| References | <sVYNk-8qL-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Jason Baron <jbaron@akamai.com> wrote:
> struct static_key {
> atomic_t enabled;
> +/*
> + * bit 0 => 1 if key is initially true
> + * 0 if initially false
> + * bit 1 => 1 if points to struct static_key_mod
> + * 0 if points to struct jump_entry
> + */
> + union {
> + unsigned long type;
> + struct jump_entry *entries;
> + struct static_key_mod *next;
> + };
> + key->type = (unsigned long)jlm2 | static_key_type(key);
> + key->type = (unsigned long)jlm | static_key_type(key);
> + *prev = (struct static_key_mod *)((unsigned long)jlm->next |
> + ((unsigned long)*prev & JUMP_TYPE_MASK));
> + key->type = (unsigned long)jlm->entries |
> + static_key_type(key);
I really hate these very ugly type conversions. Is there no cleaner way?
For example the last line could sure be written as:
key->entries = jlm->entries;
key->type |= static_key_type(key);
right?
Thanks,
Ingo
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH v2] jump_label: reduce the size of struct static_key Ingo Molnar <mingo@kernel.org> - 2017-01-20 08:30 +0100
Re: [PATCH v2] jump_label: reduce the size of struct static_key Jason Baron <jbaron@akamai.com> - 2017-01-20 21:10 +0100
Re: [PATCH v2] jump_label: reduce the size of struct static_key Ingo Molnar <mingo@kernel.org> - 2017-01-21 08:10 +0100
Re: [PATCH v2] jump_label: reduce the size of struct static_key Jason Baron <jbaron@akamai.com> - 2017-01-23 21:50 +0100
csiph-web