diff options
| author | Eric Biggers <ebiggers@google.com> | 2017-10-09 17:30:52 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-10-09 23:26:23 -0400 |
| commit | cf4c950b87ee2f547ad3abd3aca6ae3f3eb3443f (patch) | |
| tree | ec62d0b29fcd7361e4abb8cdc95042597571cf2c /lib | |
| parent | d93fa2ba64384a0bbee4ae7409d85fccb2cfcf14 (diff) | |
once: switch to new jump label API
Switch the DO_ONCE() macro from the deprecated jump label API to the new
one. The new one is more readable, and for DO_ONCE() it also makes the
generated code more icache-friendly: now the one-time initialization
code is placed out-of-line at the jump target, rather than at the inline
fallthrough case.
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/once.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/once.c b/lib/once.c index 05c8604627eb..831c5a6b0bb2 100644 --- a/lib/once.c +++ b/lib/once.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | struct once_work { | 6 | struct once_work { |
| 7 | struct work_struct work; | 7 | struct work_struct work; |
| 8 | struct static_key *key; | 8 | struct static_key_true *key; |
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | static void once_deferred(struct work_struct *w) | 11 | static void once_deferred(struct work_struct *w) |
| @@ -14,11 +14,11 @@ static void once_deferred(struct work_struct *w) | |||
| 14 | 14 | ||
| 15 | work = container_of(w, struct once_work, work); | 15 | work = container_of(w, struct once_work, work); |
| 16 | BUG_ON(!static_key_enabled(work->key)); | 16 | BUG_ON(!static_key_enabled(work->key)); |
| 17 | static_key_slow_dec(work->key); | 17 | static_branch_disable(work->key); |
| 18 | kfree(work); | 18 | kfree(work); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | static void once_disable_jump(struct static_key *key) | 21 | static void once_disable_jump(struct static_key_true *key) |
| 22 | { | 22 | { |
| 23 | struct once_work *w; | 23 | struct once_work *w; |
| 24 | 24 | ||
| @@ -51,7 +51,7 @@ bool __do_once_start(bool *done, unsigned long *flags) | |||
| 51 | } | 51 | } |
| 52 | EXPORT_SYMBOL(__do_once_start); | 52 | EXPORT_SYMBOL(__do_once_start); |
| 53 | 53 | ||
| 54 | void __do_once_done(bool *done, struct static_key *once_key, | 54 | void __do_once_done(bool *done, struct static_key_true *once_key, |
| 55 | unsigned long *flags) | 55 | unsigned long *flags) |
| 56 | __releases(once_lock) | 56 | __releases(once_lock) |
| 57 | { | 57 | { |
