You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
systemd supports setting the scheduling policy and priority of a service via the directives:
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=10
This works fine! But as SCHED_DEADLINE is also supported on Linux, it would be nice to have the ability to set the deadline policy and its parameters.
The deadline policy is set using the sched_setattr() (Linux specific) system call:
int sched_setattr(pid_t pid, struct sched_attr *attr, unsigned int flags);
The first argument is the pid of the thread and the last is for future usage (always 0 now). The scheduling information is set in the second argument, the struct sched_attr.
The size field should be set to the size of the structure in bytes, as in sizeof(struct sched_attr).
The sched_policy specifies the scheduling policy, sched deadline is SCHED_DEADLINE
The sched_flags contains flags controlling scheduling behavior, for example, RESET_ON_FORK and SCHED_FLAG_RECLAIM. The last is specific for the deadline scheduler.
sched_nice sched_priority should be zero for sched deadline.
The main fields for the sched deadline are (from man page):
sched_runtime: Specifies the "Runtime" in nanoseconds
sched_deadline: Specifies the "Deadline" in nanoseconds.
sched_period: Specifies the "Period" parameter in nanoseconds.
The runtime/deadline/and period should be at least 1024 (nanosconds) and must be: runtime <= deadline <=period.
Feel free to ping me to make questions about the parameters and to test a possible implementation (unfortunately, I don't have time to implement this now).
The text was updated successfully, but these errors were encountered:
This would be a helpful feature. It seems logical to have the option to set up SCHED_DEADLINE inside systemd rather than inside the applications that use SCHED_DEADLINE.
systemd supports setting the scheduling policy and priority of a service via the directives:
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=10
This works fine! But as SCHED_DEADLINE is also supported on Linux, it would be nice to have the ability to set the deadline policy and its parameters.
The deadline policy is set using the sched_setattr() (Linux specific) system call:
The first argument is the pid of the thread and the last is for future usage (always 0 now). The scheduling information is set in the second argument, the struct sched_attr.
The sched_attr struct is defined as:
The fields of this structure are as follows:
The size field should be set to the size of the structure in bytes, as in sizeof(struct sched_attr).
The sched_policy specifies the scheduling policy, sched deadline is SCHED_DEADLINE
The sched_flags contains flags controlling scheduling behavior, for example, RESET_ON_FORK and SCHED_FLAG_RECLAIM. The last is specific for the deadline scheduler.
sched_nice sched_priority should be zero for sched deadline.
The main fields for the sched deadline are (from man page):
sched_runtime: Specifies the "Runtime" in nanoseconds
sched_deadline: Specifies the "Deadline" in nanoseconds.
sched_period: Specifies the "Period" parameter in nanoseconds.
The runtime/deadline/and period should be at least 1024 (nanosconds) and must be: runtime <= deadline <=period.
These articles might be useful:
Deadline scheduling part 1 — overview and theory: https://lwn.net/Articles/743740/
Deadline scheduler part 2 — details and usage: https://lwn.net/Articles/743946/
Feel free to ping me to make questions about the parameters and to test a possible implementation (unfortunately, I don't have time to implement this now).
The text was updated successfully, but these errors were encountered: