public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
	rostedt@goodmis.org
Subject: Re: [PATCH] jump_label: jump_label for boot options.
Date: Thu, 1 Dec 2011 11:50:09 -0500	[thread overview]
Message-ID: <20111201165009.GB2443@redhat.com> (raw)
In-Reply-To: <1322756898.4699.30.camel@twins>

On Thu, Dec 01, 2011 at 05:28:18PM +0100, Peter Zijlstra wrote:
> On Thu, 2011-12-01 at 10:40 -0500, Jason Baron wrote:
> > I should probably rename
> > static_branch() -> 'static_branch_default_false()' to make that clear.
> 
> The rename doesn't really make sense until you can also provide
> static_branch_true() also:

I think its just a matter of reversing the true and false returns.
That is, instead of:

static __always_inline bool arch_static_branch_default_false(struct jump_label_key
*key)
{
        asm goto("1:"
                JUMP_LABEL_INITIAL_NOP
                ".pushsection __jump_table,  \"aw\" \n\t"
                _ASM_ALIGN "\n\t"
                _ASM_PTR "1b, %l[l_yes], %c0 \n\t"
                ".popsection \n\t"
                : :  "i" (key) : : l_yes);
        return false;
l_yes:
        return true;
}

We just have (untested):

static __always_inline bool arch_static_branch_default_true(struct jump_label_key
*key)
{
        asm goto("1:"
                JUMP_LABEL_INITIAL_NOP
                ".pushsection __jump_table,  \"aw\" \n\t"
                _ASM_ALIGN "\n\t"
                _ASM_PTR "1b, %l[l_no], %c0 \n\t"
                ".popsection \n\t"
                : :  "i" (key) : : l_no);
        return true;
l_no:
        return false;
}

jump_label_inc/dec(), don't need to be changed, they just mean reverse
the branch on 0, 1 transitions. Although using the same key in both
static_branch_true, and static_branch_false, might be confusing. Maybe
we rename jump_label_inc/dec to static_branch_reverse_inc()/dec()?

> 
> > Maybe we need an unbiased static_branch() too, but I'm not sure excatly
> > how to implement it... 
> 
> I'd think the same way we got in this situation in the first place, go
> kick some GCC people ;-)

If you think this is a useful case, I'll try and see how to implement it.
Then we can add static_branch_default_true/false_unbiased() :)

-Jason

  reply	other threads:[~2011-12-01 16:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01  2:53 [PATCH] jump_label: jump_label for boot options KAMEZAWA Hiroyuki
2011-12-01 14:48 ` Steven Rostedt
2011-12-01 15:06   ` Peter Zijlstra
2011-12-01 16:14     ` Steven Rostedt
2011-12-01 15:07   ` Peter Zijlstra
2011-12-02  0:18   ` KAMEZAWA Hiroyuki
2011-12-01 15:05 ` Peter Zijlstra
2011-12-02  0:22   ` KAMEZAWA Hiroyuki
2011-12-02  9:24     ` Peter Zijlstra
2011-12-02 12:45       ` Johannes Weiner
2011-12-02 12:53         ` Peter Zijlstra
2011-12-07 10:16           ` Johannes Weiner
2011-12-01 15:40 ` Jason Baron
2011-12-01 16:28   ` Peter Zijlstra
2011-12-01 16:50     ` Jason Baron [this message]
2011-12-01 17:16       ` Jason Baron
2011-12-01 18:16         ` Peter Zijlstra
2011-12-01 17:39       ` Peter Zijlstra
2011-12-01 17:45         ` Peter Zijlstra
2011-12-01 21:13         ` Jason Baron
2011-12-01 22:08           ` Peter Zijlstra
2011-12-02  0:28   ` KAMEZAWA Hiroyuki
2011-12-02  5:34     ` Mike Galbraith
2011-12-02  5:47       ` KAMEZAWA Hiroyuki
2011-12-02  8:39     ` Peter Zijlstra

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=20111201165009.GB2443@redhat.com \
    --to=jbaron@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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