1#ifndef _LINUX_SCHED_ISOLATION_H
2#define _LINUX_SCHED_ISOLATION_H
3
4#include <linux/cpumask.h>
5#include <linux/cpuset.h>
6#include <linux/init.h>
7#include <linux/tick.h>
8
9enum hk_type {
10 HK_TYPE_TIMER,
11 HK_TYPE_RCU,
12 HK_TYPE_MISC,
13 HK_TYPE_SCHED,
14 HK_TYPE_TICK,
15 HK_TYPE_DOMAIN,
16 HK_TYPE_WQ,
17 HK_TYPE_MANAGED_IRQ,
18 HK_TYPE_KTHREAD,
19 HK_TYPE_MAX
20};
21
22#ifdef CONFIG_CPU_ISOLATION
23DECLARE_STATIC_KEY_FALSE(housekeeping_overridden);
24extern int housekeeping_any_cpu(enum hk_type type);
25extern const struct cpumask *housekeeping_cpumask(enum hk_type type);
26extern bool housekeeping_enabled(enum hk_type type);
27extern void housekeeping_affine(struct task_struct *t, enum hk_type type);
28extern bool housekeeping_test_cpu(int cpu, enum hk_type type);
29extern void __init housekeeping_init(void);
30
31#else
32
33static inline int housekeeping_any_cpu(enum hk_type type)
34{
35 return smp_processor_id();
36}
37
38static inline const struct cpumask *housekeeping_cpumask(enum hk_type type)
39{
40 return cpu_possible_mask;
41}
42
43static inline bool housekeeping_enabled(enum hk_type type)
44{
45 return false;
46}
47
48static inline void housekeeping_affine(struct task_struct *t,
49 enum hk_type type) { }
50
51static inline bool housekeeping_test_cpu(int cpu, enum hk_type type)
52{
53 return true;
54}
55
56static inline void housekeeping_init(void) { }
57#endif /* CONFIG_CPU_ISOLATION */
58
59static inline bool housekeeping_cpu(int cpu, enum hk_type type)
60{
61#ifdef CONFIG_CPU_ISOLATION
62 if (static_branch_unlikely(&housekeeping_overridden))
63 return housekeeping_test_cpu(cpu, type);
64#endif
65 return true;
66}
67
68static inline bool cpu_is_isolated(int cpu)
69{
70 return !housekeeping_test_cpu(cpu, type: HK_TYPE_DOMAIN) ||
71 !housekeeping_test_cpu(cpu, type: HK_TYPE_TICK) ||
72 cpuset_cpu_is_isolated(cpu);
73}
74
75#endif /* _LINUX_SCHED_ISOLATION_H */
76

source code of linux/include/linux/sched/isolation.h