在 kernel / sched / sched.h 中,在[here]:({https://github.com/torvalds/linux/blob/9c7db5004280767566e91a33445bf93aa479ef02/kernel/sched/sched.h#L807)
中定义了数据结构运行队列。struct rq {
...
#ifdef CONFIG_SMP
struct root_domain *rd;
struct sched_domain __rcu *sd;
#endif
....
}
root_domain
和sched_domain
有什么区别?更进一步,在截止期限调度中,当cpu亲和力掩码小于整个root_domain
时的kernel rejects设置:
#ifdef CONFIG_SMP
if (dl_bandwidth_enabled() && dl_policy(policy) &&
!(attr->sched_flags & SCHED_FLAG_SUGOV)) {
cpumask_t *span = rq->rd->span;
/*
* Don't allow tasks with an affinity mask smaller than
* the entire root_domain to become SCHED_DEADLINE. We
* will also fail if there's no bandwidth available.
*/
if (!cpumask_subset(span, &p->cpus_allowed) ||
rq->rd->dl_bw.bw == 0) {
task_rq_unlock(rq, p, &rf);
return -EPERM;
}
}
#endif
在哪种情况下,CPU亲和力掩码会变得小于root_domain
跨度?
例如,当使用cpuset时,将CPU 0-1分配到专用的实时任务分区(称为rt),而其他内核正在运行常规任务,则在“ rt” cpuset中运行的任务会具有相同的{{ 1}}和root_domain.span
?