All of lore.kernel.org
 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: Sat, 21 Jan 2017 08:07:01 +0100	[thread overview]
Message-ID: <20170121070701.GA29184@gmail.com> (raw)
In-Reply-To: <3a319fba-f655-1025-5663-16d9d185e12f@akamai.com>


* 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

  reply	other threads:[~2017-01-21  7:07 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
2017-01-20 20:02   ` Jason Baron
2017-01-21  7:07     ` Ingo Molnar [this message]
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=20170121070701.GA29184@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.