[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111201165009.GB2443@redhat.com>
Date: Thu, 1 Dec 2011 11:50:09 -0500
From: Jason Baron <jbaron@...hat.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>,
rostedt@...dmis.org
Subject: Re: [PATCH] jump_label: jump_label for boot options.
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists