Ingo Molnar c5905afb0e static keys: Introduce 'struct static_key', static_key_true()/false() and static_key_slow_[inc|dec]()
So here's a boot tested patch on top of Jason's series that does
all the cleanups I talked about and turns jump labels into a
more intuitive to use facility. It should also address the
various misconceptions and confusions that surround jump labels.

Typical usage scenarios:

        #include <linux/static_key.h>

        struct static_key key = STATIC_KEY_INIT_TRUE;

        if (static_key_false(&key))
                do unlikely code
        else
                do likely code

Or:

        if (static_key_true(&key))
                do likely code
        else
                do unlikely code

The static key is modified via:

        static_key_slow_inc(&key);
        ...
        static_key_slow_dec(&key);

The 'slow' prefix makes it abundantly clear that this is an
expensive operation.

I've updated all in-kernel code to use this everywhere. Note
that I (intentionally) have not pushed through the rename
blindly through to the lowest levels: the actual jump-label
patching arch facility should be named like that, so we want to
decouple jump labels from the static-key facility a bit.

On non-jump-label enabled architectures static keys default to
likely()/unlikely() branches.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jason Baron <jbaron@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: a.p.zijlstra@chello.nl
Cc: mathieu.desnoyers@efficios.com
Cc: davem@davemloft.net
Cc: ddaney.cavm@gmail.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20120222085809.GA26397@elte.hu
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2012-02-24 10:05:59 +01:00
..
2010-08-04 10:26:03 +10:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-06-20 11:21:48 +10:00
2011-07-26 16:49:47 -07:00
2011-11-08 14:51:46 +11:00
2009-12-10 20:08:15 -06:00
2010-10-26 16:52:08 -07:00
2011-03-02 16:50:24 +11:00
2008-08-18 21:40:03 +02:00
2008-08-04 13:18:17 +10:00
2011-07-26 16:49:47 -07:00
2011-12-08 14:02:23 +11:00
2011-03-31 11:26:23 -03:00
2011-05-22 08:47:53 -04:00
2010-05-17 12:18:23 +03:00
2011-12-27 11:26:43 +02:00
2010-06-09 11:12:36 +02:00
2011-07-26 16:49:47 -07:00
2010-05-05 09:11:10 -04:00
2011-09-20 09:19:40 +10:00
2011-12-07 18:02:02 +11:00
2011-03-31 11:26:23 -03:00
2010-10-26 16:52:08 -07:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2009-04-07 15:18:58 +10:00
2009-12-09 17:10:37 +11:00
2011-09-20 09:19:40 +10:00
2011-09-27 18:08:04 +02:00
2010-03-05 03:04:08 -06:00
2011-12-09 07:51:02 -05:00
2011-04-20 17:01:19 +10:00
2011-03-31 11:26:23 -03:00
2008-09-06 19:30:15 +01:00
2009-08-28 14:24:10 +10:00
2011-10-31 17:30:44 -07:00
2011-12-16 11:09:21 +11:00
2011-10-31 17:30:44 -07:00
2011-03-31 11:26:23 -03:00
2011-05-06 13:32:35 +10:00
2011-11-08 14:51:46 +11:00