isolation.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_flags {
  7. HK_FLAG_TIMER = 1,
  8. HK_FLAG_RCU = (1 << 1),
  9. HK_FLAG_MISC = (1 << 2),
  10. HK_FLAG_SCHED = (1 << 3),
  11. HK_FLAG_TICK = (1 << 4),
  12. HK_FLAG_DOMAIN = (1 << 5),
  13. HK_FLAG_WQ = (1 << 6),
  14. };
  15. #ifdef CONFIG_CPU_ISOLATION
  16. DECLARE_STATIC_KEY_FALSE(housekeeping_overriden);
  17. extern int housekeeping_any_cpu(enum hk_flags flags);
  18. extern const struct cpumask *housekeeping_cpumask(enum hk_flags flags);
  19. extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags);
  20. extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags);
  21. extern void __init housekeeping_init(void);
  22. #else
  23. static inline int housekeeping_any_cpu(enum hk_flags flags)
  24. {
  25. return smp_processor_id();
  26. }
  27. static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags)
  28. {
  29. return cpu_possible_mask;
  30. }
  31. static inline void housekeeping_affine(struct task_struct *t,
  32. enum hk_flags flags) { }
  33. static inline void housekeeping_init(void) { }
  34. #endif /* CONFIG_CPU_ISOLATION */
  35. static inline bool housekeeping_cpu(int cpu, enum hk_flags flags)
  36. {
  37. #ifdef CONFIG_CPU_ISOLATION
  38. if (static_branch_unlikely(&housekeeping_overriden))
  39. return housekeeping_test_cpu(cpu, flags);
  40. #endif
  41. return true;
  42. }
  43. #endif /* _LINUX_SCHED_ISOLATION_H */