jump_label_ratelimit.h 871 B

12345678910111213141516171819202122232425262728293031323334
  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_slow_dec(&key->key);
  23. }
  24. static inline void
  25. jump_label_rate_limit(struct static_key_deferred *key,
  26. unsigned long rl)
  27. {
  28. }
  29. #endif /* HAVE_JUMP_LABEL */
  30. #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */