isolation.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _LINUX_SCHED_ISOLATION_H
  2. #define _LINUX_SCHED_ISOLATION_H
  3. #include <linux/cpumask.h>
  4. #include <linux/init.h>
  5. #include <linux/tick.h>
  6. enum hk_type {
  7. HK_TYPE_TIMER,
  8. HK_TYPE_RCU,
  9. HK_TYPE_MISC,
  10. HK_TYPE_SCHED,
  11. HK_TYPE_TICK,
  12. HK_TYPE_DOMAIN,
  13. HK_TYPE_WQ,
  14. HK_TYPE_MANAGED_IRQ,
  15. HK_TYPE_KTHREAD,
  16. HK_TYPE_MAX
  17. };
  18. #ifdef CONFIG_CPU_ISOLATION
  19. DECLARE_STATIC_KEY_FALSE(housekeeping_overridden);
  20. extern int housekeeping_any_cpu(enum hk_type type);
  21. extern const struct cpumask *housekeeping_cpumask(enum hk_type type);
  22. extern bool housekeeping_enabled(enum hk_type type);
  23. extern void housekeeping_affine(struct task_struct *t, enum hk_type type);
  24. extern bool housekeeping_test_cpu(int cpu, enum hk_type type);
  25. extern void __init housekeeping_init(void);
  26. #else
  27. static inline int housekeeping_any_cpu(enum hk_type type)
  28. {
  29. return smp_processor_id();
  30. }
  31. static inline const struct cpumask *housekeeping_cpumask(enum hk_type type)
  32. {
  33. return cpu_possible_mask;
  34. }
  35. static inline bool housekeeping_enabled(enum hk_type type)
  36. {
  37. return false;
  38. }
  39. static inline void housekeeping_affine(struct task_struct *t,
  40. enum hk_type type) { }
  41. static inline void housekeeping_init(void) { }
  42. #endif /* CONFIG_CPU_ISOLATION */
  43. static inline bool housekeeping_cpu(int cpu, enum hk_type type)
  44. {
  45. #ifdef CONFIG_CPU_ISOLATION
  46. if (static_branch_unlikely(&housekeeping_overridden))
  47. return housekeeping_test_cpu(cpu, type);
  48. #endif
  49. return true;
  50. }
  51. #endif /* _LINUX_SCHED_ISOLATION_H */