[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120222081855.GB25318@elte.hu>
Date: Wed, 22 Feb 2012 09:18:55 +0100
From: Ingo Molnar <mingo@...e.hu>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Jason Baron <jbaron@...hat.com>, a.p.zijlstra@...llo.nl,
mathieu.desnoyers@...icios.com, davem@...emloft.net,
ddaney.cavm@...il.com, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 00/10] jump label: introduce very_[un]likely + cleanups +
docs
* H. Peter Anvin <hpa@...or.com> wrote:
> Stupid thought... do we have cases that matter where the bias
> and default don't agree?
Yeah, that was one of my worries about the proposed original
tongue twisters (see Jason's original series: "jump label:
introduce default true branch").
For example could you tell *at a glance* what this does:
+ if (!static_branch_def_false(&perf_sched_events.key))
?
I certainly couldn't, I'd have to consider the '!', that it's a
'static branch' and that it's either 'defined to false' or
'default to false'.
Linguistic and visual barriers all around, and that's for code
that I am intimately familar with ...
The problem with static_branch_def_false/def_true was that the
very intuitively visible bias that we see with
likely()/unlikely() is confused in jump label constructs through
two layers of modifiers. And the fix is so easy, a simple rename
in most cases ;-)
So instead of that, in this series we have:
+ if (very_unlikely(&perf_sched_events.key))
which is a heck of an improvement IMO. I'd still up its
readability a notch, by also signalling the overhead of the
update path by making it:
+ if (very_unlikely(&perf_sched_events.slow_flag))
... but I don't want to be that much of a readability nazi ;-)
Thanks,
Ingo
--
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