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
4
5#include <linux/types.h>
6
7struct sched_param {
8 int sched_priority;
9};
10
11#define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */
12
13/*
14 * Extended scheduling parameters data structure.
15 *
16 * This is needed because the original struct sched_param can not be
17 * altered without introducing ABI issues with legacy applications
18 * (e.g., in sched_getparam()).
19 *
20 * However, the possibility of specifying more than just a priority for
21 * the tasks may be useful for a wide variety of application fields, e.g.,
22 * multimedia, streaming, automation and control, and many others.
23 *
24 * This variant (sched_attr) is meant at describing a so-called
25 * sporadic time-constrained task. In such model a task is specified by:
26 * - the activation period or minimum instance inter-arrival time;
27 * - the maximum (or average, depending on the actual scheduling
28 * discipline) computation time of all instances, a.k.a. runtime;
29 * - the deadline (relative to the actual activation time) of each
30 * instance.
31 * Very briefly, a periodic (sporadic) task asks for the execution of
32 * some specific computation --which is typically called an instance--
33 * (at most) every period. Moreover, each instance typically lasts no more
34 * than the runtime and must be completed by time instant t equal to
35 * the instance activation time + the deadline.
36 *
37 * This is reflected by the actual fields of the sched_attr structure:
38 *
39 * @size size of the structure, for fwd/bwd compat.
40 *
41 * @sched_policy task's scheduling policy
42 * @sched_flags for customizing the scheduler behaviour
43 * @sched_nice task's nice value (SCHED_NORMAL/BATCH)
44 * @sched_priority task's static priority (SCHED_FIFO/RR)
45 * @sched_deadline representative of the task's deadline
46 * @sched_runtime representative of the task's runtime
47 * @sched_period representative of the task's period
48 *
49 * Given this task model, there are a multiplicity of scheduling algorithms
50 * and policies, that can be used to ensure all the tasks will make their
51 * timing constraints.
52 *
53 * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the
54 * only user of this new interface. More information about the algorithm
55 * available in the scheduling class file or in Documentation/.
56 */
57struct sched_attr {
58 __u32 size;
59
60 __u32 sched_policy;
61 __u64 sched_flags;
62
63 /* SCHED_NORMAL, SCHED_BATCH */
64 __s32 sched_nice;
65
66 /* SCHED_FIFO, SCHED_RR */
67 __u32 sched_priority;
68
69 /* SCHED_DEADLINE */
70 __u64 sched_runtime;
71 __u64 sched_deadline;
72 __u64 sched_period;
73};
74
75#endif /* _UAPI_LINUX_SCHED_TYPES_H */
76