Reputation: 51
I am following Minimal main in sched-deadline page in https://www.kernel.org/doc/Documentation/scheduler/sched-deadline.txt. From the manual:
In addition, under the current implementation, all of the parameter values must be at least 1024 (i.e., just over one microsecond, which is the resolution of the implementation), and less than 2^63. If any of these checks fails, sched_setattr(2) fails with the error EINVAL.
However, when I enter any value less than 100*000 (ns) (e.g 99 *1000) in deadline/period, I get error:
sched_setattr: Invalid argument
Here is my code, changed from Minimal-main in sched-deadline webpage:
/* This creates an execution_time/99 us reservation */
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = execution_time + 1024 ;
attr.sched_period = attr.sched_deadline =99*1000 ;
ret = sched_setattr(0, &attr, flags);
printf("We have called sched_setattr, and ret value is:%d\n", ret);
if (ret < 0) {
done = 0;
perror("sched_setattr");
exit(-1);
}
What am I missing here?
Upvotes: 1
Views: 197
Reputation: 51
The root/kernel/sched/deadline.c says it:
Default limits for DL period; on the top end we guard against small util tasks still getting ridiculously long effective runtimes, on the bottom end we guard against timer DoS.
static unsigned int sysctl_sched_dl_period_max = 1 << 22; /* ~4 seconds */
static unsigned int sysctl_sched_dl_period_min = 100; /* 100 us */
Upvotes: 2