Blame view
include/linux/jump_label_ratelimit.h
2.77 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
851cf6e7d jump_label: Split... |
2 3 4 5 6 |
#ifndef _LINUX_JUMP_LABEL_RATELIMIT_H #define _LINUX_JUMP_LABEL_RATELIMIT_H #include <linux/jump_label.h> #include <linux/workqueue.h> |
e9666d10a jump_label: move ... |
7 |
#if defined(CONFIG_JUMP_LABEL) |
851cf6e7d jump_label: Split... |
8 9 10 11 12 |
struct static_key_deferred { struct static_key key; unsigned long timeout; struct delayed_work work; }; |
851cf6e7d jump_label: Split... |
13 |
|
ad282a811 locking/static_ke... |
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
struct static_key_true_deferred { struct static_key_true key; unsigned long timeout; struct delayed_work work; }; struct static_key_false_deferred { struct static_key_false key; unsigned long timeout; struct delayed_work work; }; #define static_key_slow_dec_deferred(x) \ __static_key_slow_dec_deferred(&(x)->key, &(x)->work, (x)->timeout) #define static_branch_slow_dec_deferred(x) \ __static_key_slow_dec_deferred(&(x)->key.key, &(x)->work, (x)->timeout) #define static_key_deferred_flush(x) \ __static_key_deferred_flush((x), &(x)->work) extern void __static_key_slow_dec_deferred(struct static_key *key, struct delayed_work *work, unsigned long timeout); extern void __static_key_deferred_flush(void *key, struct delayed_work *work); |
851cf6e7d jump_label: Split... |
39 40 |
extern void jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); |
ad282a811 locking/static_ke... |
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
extern void jump_label_update_timeout(struct work_struct *work); #define DEFINE_STATIC_KEY_DEFERRED_TRUE(name, rl) \ struct static_key_true_deferred name = { \ .key = { STATIC_KEY_INIT_TRUE }, \ .timeout = (rl), \ .work = __DELAYED_WORK_INITIALIZER((name).work, \ jump_label_update_timeout, \ 0), \ } #define DEFINE_STATIC_KEY_DEFERRED_FALSE(name, rl) \ struct static_key_false_deferred name = { \ .key = { STATIC_KEY_INIT_FALSE }, \ .timeout = (rl), \ .work = __DELAYED_WORK_INITIALIZER((name).work, \ jump_label_update_timeout, \ 0), \ } |
e9666d10a jump_label: move ... |
60 |
#else /* !CONFIG_JUMP_LABEL */ |
851cf6e7d jump_label: Split... |
61 62 63 |
struct static_key_deferred { struct static_key key; }; |
ad282a811 locking/static_ke... |
64 65 66 67 68 69 70 71 72 73 74 75 |
struct static_key_true_deferred { struct static_key_true key; }; struct static_key_false_deferred { struct static_key_false key; }; #define DEFINE_STATIC_KEY_DEFERRED_TRUE(name, rl) \ struct static_key_true_deferred name = { STATIC_KEY_TRUE_INIT } #define DEFINE_STATIC_KEY_DEFERRED_FALSE(name, rl) \ struct static_key_false_deferred name = { STATIC_KEY_FALSE_INIT } #define static_branch_slow_dec_deferred(x) static_branch_dec(&(x)->key) |
851cf6e7d jump_label: Split... |
76 77 |
static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) { |
5cdda5117 locking/static_ke... |
78 |
STATIC_KEY_CHECK_USE(key); |
851cf6e7d jump_label: Split... |
79 80 |
static_key_slow_dec(&key->key); } |
ad282a811 locking/static_ke... |
81 |
static inline void static_key_deferred_flush(void *key) |
b6416e610 jump_labels: API ... |
82 |
{ |
5cdda5117 locking/static_ke... |
83 |
STATIC_KEY_CHECK_USE(key); |
b6416e610 jump_labels: API ... |
84 |
} |
851cf6e7d jump_label: Split... |
85 86 87 88 |
static inline void jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl) { |
5cdda5117 locking/static_ke... |
89 |
STATIC_KEY_CHECK_USE(key); |
851cf6e7d jump_label: Split... |
90 |
} |
e9666d10a jump_label: move ... |
91 |
#endif /* CONFIG_JUMP_LABEL */ |
f01c373fb locking/static_ke... |
92 93 |
#define static_branch_deferred_inc(x) static_branch_inc(&(x)->key) |
851cf6e7d jump_label: Split... |
94 |
#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ |