isolation.h 1018 字节
Newer Older
1 2 3 4 5 6 7
#ifndef _LINUX_SCHED_ISOLATION_H
#define _LINUX_SCHED_ISOLATION_H

#include <linux/cpumask.h>
#include <linux/init.h>
#include <linux/tick.h>

8
#ifdef CONFIG_CPU_ISOLATION
9
DECLARE_STATIC_KEY_FALSE(housekeeping_overriden);
10 11 12 13
extern int housekeeping_any_cpu(void);
extern const struct cpumask *housekeeping_cpumask(void);
extern void housekeeping_affine(struct task_struct *t);
extern bool housekeeping_test_cpu(int cpu);
14
extern void __init housekeeping_init(void);
15

16 17 18 19 20 21 22 23 24 25 26 27
#else

static inline int housekeeping_any_cpu(void)
{
	return smp_processor_id();
}

static inline const struct cpumask *housekeeping_cpumask(void)
{
	return cpu_possible_mask;
}

28 29
static inline void housekeeping_affine(struct task_struct *t) { }
static inline void housekeeping_init(void) { }
30
#endif /* CONFIG_CPU_ISOLATION */
31

32
static inline bool housekeeping_cpu(int cpu)
33
{
34
#ifdef CONFIG_CPU_ISOLATION
35
	if (static_branch_unlikely(&housekeeping_overriden))
36
		return housekeeping_test_cpu(cpu);
37 38 39 40 41
#endif
	return true;
}

#endif /* _LINUX_SCHED_ISOLATION_H */