rtla tools:When I attempted to test the osnoise using the SCHED_DEADLINE scheduling policy, I encountered the error:
Failed to set sched attributes to the pid xxx: Operation not permitted
Error setting sched attributes for pid:xxx
Failed to set sched parameters
The command I used was:
timerlat hist -d 10m -c 0-3 -P d:100us:1ms
Why does this situation occur?
Debugging in the kernel, I found that this part of the code was causing the error:
/kernel/sched/core.c __sched_setscheduler():
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_ptr) ||
rq->rd->dl_bw.bw == 0) {
retval = -EPERM;
goto unlock;
}
}
I ran an “example of using the SCHED_DEADLINE scheduling policy[https://www.kernel.org/doc/html/latest/scheduler/sched-deadline.html]” ,everything is OK