isolation.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. };
  14. #ifdef CONFIG_CPU_ISOLATION
  15. DECLARE_STATIC_KEY_FALSE(housekeeping_overriden);
  16. extern int housekeeping_any_cpu(enum hk_flags flags);
  17. extern const struct cpumask *housekeeping_cpumask(enum hk_flags flags);
  18. extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags);
  19. extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags);
  20. extern void __init housekeeping_init(void);
  21. #else
  22. static inline int housekeeping_any_cpu(enum hk_flags flags)
  23. {
  24. return smp_processor_id();
  25. }
  26. static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags)
  27. {
  28. return cpu_possible_mask;
  29. }
  30. static inline void housekeeping_affine(struct task_struct *t,
  31. enum hk_flags flags) { }
  32. static inline void housekeeping_init(void) { }
  33. #endif /* CONFIG_CPU_ISOLATION */
  34. static inline bool housekeeping_cpu(int cpu, enum hk_flags flags)
  35. {
  36. #ifdef CONFIG_CPU_ISOLATION
  37. if (static_branch_unlikely(&housekeeping_overriden))
  38. return housekeeping_test_cpu(cpu, flags);
  39. #endif
  40. return true;
  41. }
  42. #endif /* _LINUX_SCHED_ISOLATION_H */