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-09-27 18:08:04 +02:00
2011-03-31 11:26:23 -03:00
2011-12-07 22:03:45 +00:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2009-07-03 15:45:26 +01:00
2008-12-12 18:12:23 +00:00
2010-02-27 12:53:42 +01:00
2011-12-07 22:03:18 +00:00
2010-08-05 13:26:29 +01:00
2009-12-05 09:10:12 -08:00
2011-05-10 18:15:24 +01:00
2010-02-27 12:53:27 +01:00
2009-07-03 15:45:29 +01:00
2011-07-25 17:26:53 +01:00
2009-12-17 01:57:32 +00:00
2010-10-26 16:52:08 -07:00
2011-07-26 16:49:47 -07:00
2009-06-17 11:06:28 +01:00
2011-03-31 11:26:23 -03:00
2010-08-05 13:26:29 +01:00
2010-06-09 11:12:36 +02:00
2011-07-26 16:49:47 -07:00
2011-01-13 17:32:47 -08:00
2010-04-12 17:26:14 +01:00
2010-02-27 12:53:14 +01:00
2010-02-27 12:53:14 +01:00
2011-03-31 11:26:23 -03:00
2012-01-11 15:37:13 +01:00
2010-02-27 12:53:27 +01:00
2011-07-25 17:26:51 +01:00
2011-03-31 11:26:23 -03:00
2009-07-03 15:45:27 +01:00
2010-02-27 12:53:27 +01:00
2009-11-02 12:00:01 +01:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-07-20 23:12:10 +01:00
2010-02-27 12:53:14 +01:00
2010-02-27 12:53:42 +01:00
2010-08-09 16:48:44 -04:00
2011-12-07 22:01:45 +00:00
2011-12-07 22:03:18 +00:00
2011-07-26 06:47:36 +01:00
2010-02-27 12:53:27 +01:00
2010-04-12 17:26:14 +01:00
2011-03-31 11:26:23 -03:00