Andrew Jones | 851cf6e | 2013-08-09 19:51:57 +0530 | [diff] [blame] | 1 | #ifndef _LINUX_JUMP_LABEL_RATELIMIT_H |
| 2 | #define _LINUX_JUMP_LABEL_RATELIMIT_H |
| 3 | |
| 4 | #include <linux/jump_label.h> |
| 5 | #include <linux/workqueue.h> |
| 6 | |
| 7 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) |
| 8 | struct static_key_deferred { |
| 9 | struct static_key key; |
| 10 | unsigned long timeout; |
| 11 | struct delayed_work work; |
| 12 | }; |
| 13 | #endif |
| 14 | |
| 15 | #ifdef HAVE_JUMP_LABEL |
| 16 | extern void static_key_slow_dec_deferred(struct static_key_deferred *key); |
David Matlack | b6416e6 | 2016-12-16 14:30:35 -0800 | [diff] [blame] | 17 | extern void static_key_deferred_flush(struct static_key_deferred *key); |
Andrew Jones | 851cf6e | 2013-08-09 19:51:57 +0530 | [diff] [blame] | 18 | extern void |
| 19 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); |
| 20 | |
| 21 | #else /* !HAVE_JUMP_LABEL */ |
| 22 | struct static_key_deferred { |
| 23 | struct static_key key; |
| 24 | }; |
| 25 | static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) |
| 26 | { |
Hannes Frederic Sowa | c4b2c0c | 2013-10-19 21:48:53 +0200 | [diff] [blame] | 27 | STATIC_KEY_CHECK_USE(); |
Andrew Jones | 851cf6e | 2013-08-09 19:51:57 +0530 | [diff] [blame] | 28 | static_key_slow_dec(&key->key); |
| 29 | } |
David Matlack | b6416e6 | 2016-12-16 14:30:35 -0800 | [diff] [blame] | 30 | static inline void static_key_deferred_flush(struct static_key_deferred *key) |
| 31 | { |
| 32 | STATIC_KEY_CHECK_USE(); |
| 33 | } |
Andrew Jones | 851cf6e | 2013-08-09 19:51:57 +0530 | [diff] [blame] | 34 | static inline void |
| 35 | jump_label_rate_limit(struct static_key_deferred *key, |
| 36 | unsigned long rl) |
| 37 | { |
Hannes Frederic Sowa | c4b2c0c | 2013-10-19 21:48:53 +0200 | [diff] [blame] | 38 | STATIC_KEY_CHECK_USE(); |
Andrew Jones | 851cf6e | 2013-08-09 19:51:57 +0530 | [diff] [blame] | 39 | } |
| 40 | #endif /* HAVE_JUMP_LABEL */ |
| 41 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ |