Back to home page

OSCL-LXR

 
 

    


0001 #ifndef _LINUX_SCHED_ISOLATION_H
0002 #define _LINUX_SCHED_ISOLATION_H
0003 
0004 #include <linux/cpumask.h>
0005 #include <linux/init.h>
0006 #include <linux/tick.h>
0007 
0008 enum hk_type {
0009     HK_TYPE_TIMER,
0010     HK_TYPE_RCU,
0011     HK_TYPE_MISC,
0012     HK_TYPE_SCHED,
0013     HK_TYPE_TICK,
0014     HK_TYPE_DOMAIN,
0015     HK_TYPE_WQ,
0016     HK_TYPE_MANAGED_IRQ,
0017     HK_TYPE_KTHREAD,
0018     HK_TYPE_MAX
0019 };
0020 
0021 #ifdef CONFIG_CPU_ISOLATION
0022 DECLARE_STATIC_KEY_FALSE(housekeeping_overridden);
0023 extern int housekeeping_any_cpu(enum hk_type type);
0024 extern const struct cpumask *housekeeping_cpumask(enum hk_type type);
0025 extern bool housekeeping_enabled(enum hk_type type);
0026 extern void housekeeping_affine(struct task_struct *t, enum hk_type type);
0027 extern bool housekeeping_test_cpu(int cpu, enum hk_type type);
0028 extern void __init housekeeping_init(void);
0029 
0030 #else
0031 
0032 static inline int housekeeping_any_cpu(enum hk_type type)
0033 {
0034     return smp_processor_id();
0035 }
0036 
0037 static inline const struct cpumask *housekeeping_cpumask(enum hk_type type)
0038 {
0039     return cpu_possible_mask;
0040 }
0041 
0042 static inline bool housekeeping_enabled(enum hk_type type)
0043 {
0044     return false;
0045 }
0046 
0047 static inline void housekeeping_affine(struct task_struct *t,
0048                        enum hk_type type) { }
0049 static inline void housekeeping_init(void) { }
0050 #endif /* CONFIG_CPU_ISOLATION */
0051 
0052 static inline bool housekeeping_cpu(int cpu, enum hk_type type)
0053 {
0054 #ifdef CONFIG_CPU_ISOLATION
0055     if (static_branch_unlikely(&housekeeping_overridden))
0056         return housekeeping_test_cpu(cpu, type);
0057 #endif
0058     return true;
0059 }
0060 
0061 #endif /* _LINUX_SCHED_ISOLATION_H */