jump_label_ratelimit.h 921 B

123456789101112131415161718192021222324252627282930313233343536
  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
  15. jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
  16. #else /* !HAVE_JUMP_LABEL */
  17. struct static_key_deferred {
  18. struct static_key key;
  19. };
  20. static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
  21. {
  22. STATIC_KEY_CHECK_USE();
  23. static_key_slow_dec(&key->key);
  24. }
  25. static inline void
  26. jump_label_rate_limit(struct static_key_deferred *key,
  27. unsigned long rl)
  28. {
  29. STATIC_KEY_CHECK_USE();
  30. }
  31. #endif /* HAVE_JUMP_LABEL */
  32. #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */