linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Jason Baron <jbaron@akamai.com>
Cc: peterz@infradead.org, rostedt@goodmis.org,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2] jump_label: reduce the size of struct static_key
Date: Fri, 20 Jan 2017 08:19:14 +0100	[thread overview]
Message-ID: <20170120071914.GA17003@gmail.com> (raw)
In-Reply-To: <1483555303-13493-1-git-send-email-jbaron@akamai.com>


* 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

  parent reply	other threads:[~2017-01-20  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-04 18:41 [PATCH v2] jump_label: reduce the size of struct static_key Jason Baron
2017-01-19 18:58 ` Jason Baron
2017-01-20  7:19 ` Ingo Molnar [this message]
2017-01-20 20:02   ` Jason Baron
2017-01-21  7:07     ` Ingo Molnar
2017-01-23 20:48       ` Jason Baron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170120071914.GA17003@gmail.com \
    --to=mingo@kernel.org \
    --cc=jbaron@akamai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).