1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_LINUX_SCHED_TYPES_H
3 #define _UAPI_LINUX_SCHED_TYPES_H
5 #include <linux/types.h>
11 #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */
12 #define SCHED_ATTR_SIZE_VER1 56 /* add: util_{min,max} */
15 * Extended scheduling parameters data structure.
17 * This is needed because the original struct sched_param can not be
18 * altered without introducing ABI issues with legacy applications
19 * (e.g., in sched_getparam()).
21 * However, the possibility of specifying more than just a priority for
22 * the tasks may be useful for a wide variety of application fields, e.g.,
23 * multimedia, streaming, automation and control, and many others.
25 * This variant (sched_attr) allows to define additional attributes to
26 * improve the scheduler knowledge about task requirements.
28 * Scheduling Class Attributes
29 * ===========================
31 * A subset of sched_attr attributes specifies the
32 * scheduling policy and relative POSIX attributes:
34 * @size size of the structure, for fwd/bwd compat.
36 * @sched_policy task's scheduling policy
37 * @sched_nice task's nice value (SCHED_NORMAL/BATCH)
38 * @sched_priority task's static priority (SCHED_FIFO/RR)
40 * Certain more advanced scheduling features can be controlled by a
41 * predefined set of flags via the attribute:
43 * @sched_flags for customizing the scheduler behaviour
45 * Sporadic Time-Constrained Task Attributes
46 * =========================================
48 * A subset of sched_attr attributes allows to describe a so-called
49 * sporadic time-constrained task.
51 * In such a model a task is specified by:
52 * - the activation period or minimum instance inter-arrival time;
53 * - the maximum (or average, depending on the actual scheduling
54 * discipline) computation time of all instances, a.k.a. runtime;
55 * - the deadline (relative to the actual activation time) of each
57 * Very briefly, a periodic (sporadic) task asks for the execution of
58 * some specific computation --which is typically called an instance--
59 * (at most) every period. Moreover, each instance typically lasts no more
60 * than the runtime and must be completed by time instant t equal to
61 * the instance activation time + the deadline.
63 * This is reflected by the following fields of the sched_attr structure:
65 * @sched_deadline representative of the task's deadline
66 * @sched_runtime representative of the task's runtime
67 * @sched_period representative of the task's period
69 * Given this task model, there are a multiplicity of scheduling algorithms
70 * and policies, that can be used to ensure all the tasks will make their
73 * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the
74 * only user of this new interface. More information about the algorithm
75 * available in the scheduling class file or in Documentation/.
77 * Task Utilization Attributes
78 * ===========================
80 * A subset of sched_attr attributes allows to specify the utilization
81 * expected for a task. These attributes allow to inform the scheduler about
82 * the utilization boundaries within which it should schedule the task. These
83 * boundaries are valuable hints to support scheduler decisions on both task
84 * placement and frequency selection.
86 * @sched_util_min represents the minimum utilization
87 * @sched_util_max represents the maximum utilization
89 * Utilization is a value in the range [0..SCHED_CAPACITY_SCALE]. It
90 * represents the percentage of CPU time used by a task when running at the
91 * maximum frequency on the highest capacity CPU of the system. For example, a
92 * 20% utilization task is a task running for 2ms every 10ms at maximum
95 * A task with a min utilization value bigger than 0 is more likely scheduled
96 * on a CPU with a capacity big enough to fit the specified value.
97 * A task with a max utilization value smaller than 1024 is more likely
98 * scheduled on a CPU with no more capacity than the specified value.
100 * A task utilization boundary can be reset by setting the attribute to -1.
108 /* SCHED_NORMAL, SCHED_BATCH */
111 /* SCHED_FIFO, SCHED_RR */
112 __u32 sched_priority;
116 __u64 sched_deadline;
119 /* Utilization hints */
120 __u32 sched_util_min;
121 __u32 sched_util_max;
125 #endif /* _UAPI_LINUX_SCHED_TYPES_H */