sched/isolation: Use its own static key
[linux-2.6-block.git] / include / linux / sched / isolation.h
CommitLineData
78634061
FW
1#ifndef _LINUX_SCHED_ISOLATION_H
2#define _LINUX_SCHED_ISOLATION_H
3
4#include <linux/cpumask.h>
5#include <linux/init.h>
6#include <linux/tick.h>
7
8#ifdef CONFIG_NO_HZ_FULL
e179f5a0 9DECLARE_STATIC_KEY_FALSE(housekeeping_overriden);
7e56a1cf
FW
10extern int housekeeping_any_cpu(void);
11extern const struct cpumask *housekeeping_cpumask(void);
12extern void housekeeping_affine(struct task_struct *t);
13extern bool housekeeping_test_cpu(int cpu);
78634061 14extern void __init housekeeping_init(void);
7e56a1cf 15
78634061
FW
16#else
17
18static inline int housekeeping_any_cpu(void)
19{
20 return smp_processor_id();
21}
22
78634061
FW
23static inline const struct cpumask *housekeeping_cpumask(void)
24{
78634061
FW
25 return cpu_possible_mask;
26}
27
7e56a1cf
FW
28static inline void housekeeping_affine(struct task_struct *t) { }
29static inline void housekeeping_init(void) { }
30#endif /* CONFIG_NO_HZ_FULL */
31
78634061
FW
32static inline bool is_housekeeping_cpu(int cpu)
33{
34#ifdef CONFIG_NO_HZ_FULL
e179f5a0 35 if (static_branch_unlikely(&housekeeping_overriden))
7e56a1cf 36 return housekeeping_test_cpu(cpu);
78634061
FW
37#endif
38 return true;
39}
40
78634061 41#endif /* _LINUX_SCHED_ISOLATION_H */