Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1199194
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface |
| Date | 2015-08-03 21:10 +0200 |
| Message-ID | <pTthw-3DC-15@gated-at.bofh.it> (permalink) |
| References | <pRd7c-27d-3@gated-at.bofh.it> <pRd7f-27d-75@gated-at.bofh.it> <pRtOF-189-11@gated-at.bofh.it> <pRvdL-31w-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 29 Jul 2015 10:49:06 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, Jul 29, 2015 at 09:19:22AM +0200, Vlastimil Babka wrote:
>
> > How would one define a static key that's e.g. expected to be mostly false, but
> > with initial value of true, e.g. during boot?
>
> DEFINE_STATIC_KEY_TRUE(blah);
>
> will get you the true at boot time.
>
> You'll then want to use:
>
> if (static_branch_unlikely(&blah)) {
> /* code that mostly doesn't happen */
> }
>
> To indicate you expect it to be false most of the time. And you'll flip
> it to false at runtime using:
>
> static_branch_disable(&blah);
I wonder if static_branch_set_false(&blah) would be a better name to
understand. What does "disable" / "enable" mean?
If we declare it "TRUE" when defining it, it only makes sense to change
it to "false" later on.
-- Steve
>
> If GCC co-operates, the body of the branch will be placed out-of-line,
> we'll emit a jump to it by default, but once you disable it, we'll nop
> the jump and fall straight through.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-07-29 10:50 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Steven Rostedt <rostedt@goodmis.org> - 2015-08-03 21:10 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-08-03 21:20 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Steven Rostedt <rostedt@goodmis.org> - 2015-08-03 21:30 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-08-03 22:10 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Steven Rostedt <rostedt@goodmis.org> - 2015-08-04 00:00 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Borislav Petkov <bp@alien8.de> - 2015-08-04 05:40 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Andy Lutomirski <luto@amacapital.net> - 2015-08-04 06:10 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Borislav Petkov <bp@alien8.de> - 2015-08-04 06:30 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Steven Rostedt <rostedt@goodmis.org> - 2015-08-04 14:10 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Borislav Petkov <bp@alien8.de> - 2015-08-04 16:40 +0200
Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Andy Lutomirski <luto@amacapital.net> - 2015-08-04 17:00 +0200
csiph-web