jump_label_ratelimit.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _LINUX_JUMP_LABEL_RATELIMIT_H
  2. #define _LINUX_JUMP_LABEL_RATELIMIT_H
  3. #include <linux/jump_label.h>
  4. #include <linux/workqueue.h>
  5. #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
  6. struct static_key_deferred {
  7. struct static_key key;
  8. unsigned long timeout;
  9. struct delayed_work work;
  10. };
  11. #endif
  12. #ifdef HAVE_JUMP_LABEL
  13. extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
  14. extern void static_key_deferred_flush(struct static_key_deferred *key);
  15. extern void
  16. jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
  17. #else /* !HAVE_JUMP_LABEL */
  18. struct static_key_deferred {
  19. struct static_key key;
  20. };
  21. static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
  22. {
  23. STATIC_KEY_CHECK_USE();
  24. static_key_slow_dec(&key->key);
  25. }
  26. static inline void static_key_deferred_flush(struct static_key_deferred *key)
  27. {
  28. STATIC_KEY_CHECK_USE();
  29. }
  30. static inline void
  31. jump_label_rate_limit(struct static_key_deferred *key,
  32. unsigned long rl)
  33. {
  34. STATIC_KEY_CHECK_USE();
  35. }
  36. #endif /* HAVE_JUMP_LABEL */
  37. #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */