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
..
2011-03-31 11:26:23 -03:00
2011-12-28 15:06:58 -05:00
2011-07-26 16:49:47 -07:00
2011-05-05 11:10:14 -07:00
2010-06-03 03:21:52 -07:00
2010-10-27 11:37:32 -07:00
2012-01-17 10:31:12 -05:00
2011-03-31 11:26:23 -03:00
2011-12-03 09:35:05 -08:00
2011-07-26 16:49:47 -07:00
2011-12-11 18:25:16 -05:00
2010-10-25 13:09:45 -07:00
2011-12-11 18:25:16 -05:00
2010-10-27 11:37:32 -07:00
2011-03-31 11:26:23 -03:00
2011-09-16 19:20:20 -04:00
2011-07-26 16:49:47 -07:00
2010-06-03 03:21:52 -07:00
2011-05-17 14:16:58 -04:00
2011-12-11 18:25:16 -05:00
2011-12-11 18:25:16 -05:00
2011-03-31 11:26:23 -03:00
2010-11-28 11:12:20 -08:00
2011-11-22 16:43:32 -05:00