diff options
| author | Ingo Molnar <mingo@kernel.org> | 2014-08-24 16:35:42 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2014-08-24 16:35:42 -0400 |
| commit | 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47 (patch) | |
| tree | 2e724df80122ab26416365e972454896b1250bec /include/linux | |
| parent | 83bc90e11576f9c100f8ef4ba2bcd0b89212e3fb (diff) | |
| parent | fd3cbdc0d1b5254a2e8793df58c409b469899a3f (diff) | |
Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/jump_label.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 784304b222b3..98f923b6a0ea 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
| @@ -8,28 +8,28 @@ | |||
| 8 | * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> |
| 9 | * | 9 | * |
| 10 | * Jump labels provide an interface to generate dynamic branches using | 10 | * Jump labels provide an interface to generate dynamic branches using |
| 11 | * self-modifying code. Assuming toolchain and architecture support the result | 11 | * self-modifying code. Assuming toolchain and architecture support, the result |
| 12 | * of a "if (static_key_false(&key))" statement is a unconditional branch (which | 12 | * of a "if (static_key_false(&key))" statement is an unconditional branch (which |
| 13 | * defaults to false - and the true block is placed out of line). | 13 | * defaults to false - and the true block is placed out of line). |
| 14 | * | 14 | * |
| 15 | * However at runtime we can change the branch target using | 15 | * However at runtime we can change the branch target using |
| 16 | * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key | 16 | * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key |
| 17 | * object and for as long as there are references all branches referring to | 17 | * object, and for as long as there are references all branches referring to |
| 18 | * that particular key will point to the (out of line) true block. | 18 | * that particular key will point to the (out of line) true block. |
| 19 | * | 19 | * |
| 20 | * Since this relies on modifying code the static_key_slow_{inc,dec}() functions | 20 | * Since this relies on modifying code, the static_key_slow_{inc,dec}() functions |
| 21 | * must be considered absolute slow paths (machine wide synchronization etc.). | 21 | * must be considered absolute slow paths (machine wide synchronization etc.). |
| 22 | * OTOH, since the affected branches are unconditional their runtime overhead | 22 | * OTOH, since the affected branches are unconditional, their runtime overhead |
| 23 | * will be absolutely minimal, esp. in the default (off) case where the total | 23 | * will be absolutely minimal, esp. in the default (off) case where the total |
| 24 | * effect is a single NOP of appropriate size. The on case will patch in a jump | 24 | * effect is a single NOP of appropriate size. The on case will patch in a jump |
| 25 | * to the out-of-line block. | 25 | * to the out-of-line block. |
| 26 | * | 26 | * |
| 27 | * When the control is directly exposed to userspace it is prudent to delay the | 27 | * When the control is directly exposed to userspace, it is prudent to delay the |
| 28 | * decrement to avoid high frequency code modifications which can (and do) | 28 | * decrement to avoid high frequency code modifications which can (and do) |
| 29 | * cause significant performance degradation. Struct static_key_deferred and | 29 | * cause significant performance degradation. Struct static_key_deferred and |
| 30 | * static_key_slow_dec_deferred() provide for this. | 30 | * static_key_slow_dec_deferred() provide for this. |
| 31 | * | 31 | * |
| 32 | * Lacking toolchain and or architecture support, it falls back to a simple | 32 | * Lacking toolchain and or architecture support, jump labels fall back to a simple |
| 33 | * conditional branch. | 33 | * conditional branch. |
| 34 | * | 34 | * |
| 35 | * struct static_key my_key = STATIC_KEY_INIT_TRUE; | 35 | * struct static_key my_key = STATIC_KEY_INIT_TRUE; |
| @@ -43,8 +43,7 @@ | |||
| 43 | * | 43 | * |
| 44 | * Not initializing the key (static data is initialized to 0s anyway) is the | 44 | * Not initializing the key (static data is initialized to 0s anyway) is the |
| 45 | * same as using STATIC_KEY_INIT_FALSE. | 45 | * same as using STATIC_KEY_INIT_FALSE. |
| 46 | * | 46 | */ |
| 47 | */ | ||
| 48 | 47 | ||
| 49 | #include <linux/types.h> | 48 | #include <linux/types.h> |
| 50 | #include <linux/compiler.h> | 49 | #include <linux/compiler.h> |
