Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_LINUX_SCHED_TYPES_H
0003 #define _UAPI_LINUX_SCHED_TYPES_H
0004 
0005 #include <linux/types.h>
0006 
0007 struct sched_param {
0008     int sched_priority;
0009 };
0010 
0011 #define SCHED_ATTR_SIZE_VER0    48  /* sizeof first published struct */
0012 #define SCHED_ATTR_SIZE_VER1    56  /* add: util_{min,max} */
0013 
0014 /*
0015  * Extended scheduling parameters data structure.
0016  *
0017  * This is needed because the original struct sched_param can not be
0018  * altered without introducing ABI issues with legacy applications
0019  * (e.g., in sched_getparam()).
0020  *
0021  * However, the possibility of specifying more than just a priority for
0022  * the tasks may be useful for a wide variety of application fields, e.g.,
0023  * multimedia, streaming, automation and control, and many others.
0024  *
0025  * This variant (sched_attr) allows to define additional attributes to
0026  * improve the scheduler knowledge about task requirements.
0027  *
0028  * Scheduling Class Attributes
0029  * ===========================
0030  *
0031  * A subset of sched_attr attributes specifies the
0032  * scheduling policy and relative POSIX attributes:
0033  *
0034  *  @size       size of the structure, for fwd/bwd compat.
0035  *
0036  *  @sched_policy   task's scheduling policy
0037  *  @sched_nice     task's nice value      (SCHED_NORMAL/BATCH)
0038  *  @sched_priority task's static priority (SCHED_FIFO/RR)
0039  *
0040  * Certain more advanced scheduling features can be controlled by a
0041  * predefined set of flags via the attribute:
0042  *
0043  *  @sched_flags    for customizing the scheduler behaviour
0044  *
0045  * Sporadic Time-Constrained Task Attributes
0046  * =========================================
0047  *
0048  * A subset of sched_attr attributes allows to describe a so-called
0049  * sporadic time-constrained task.
0050  *
0051  * In such a model a task is specified by:
0052  *  - the activation period or minimum instance inter-arrival time;
0053  *  - the maximum (or average, depending on the actual scheduling
0054  *    discipline) computation time of all instances, a.k.a. runtime;
0055  *  - the deadline (relative to the actual activation time) of each
0056  *    instance.
0057  * Very briefly, a periodic (sporadic) task asks for the execution of
0058  * some specific computation --which is typically called an instance--
0059  * (at most) every period. Moreover, each instance typically lasts no more
0060  * than the runtime and must be completed by time instant t equal to
0061  * the instance activation time + the deadline.
0062  *
0063  * This is reflected by the following fields of the sched_attr structure:
0064  *
0065  *  @sched_deadline representative of the task's deadline
0066  *  @sched_runtime  representative of the task's runtime
0067  *  @sched_period   representative of the task's period
0068  *
0069  * Given this task model, there are a multiplicity of scheduling algorithms
0070  * and policies, that can be used to ensure all the tasks will make their
0071  * timing constraints.
0072  *
0073  * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the
0074  * only user of this new interface. More information about the algorithm
0075  * available in the scheduling class file or in Documentation/.
0076  *
0077  * Task Utilization Attributes
0078  * ===========================
0079  *
0080  * A subset of sched_attr attributes allows to specify the utilization
0081  * expected for a task. These attributes allow to inform the scheduler about
0082  * the utilization boundaries within which it should schedule the task. These
0083  * boundaries are valuable hints to support scheduler decisions on both task
0084  * placement and frequency selection.
0085  *
0086  *  @sched_util_min represents the minimum utilization
0087  *  @sched_util_max represents the maximum utilization
0088  *
0089  * Utilization is a value in the range [0..SCHED_CAPACITY_SCALE]. It
0090  * represents the percentage of CPU time used by a task when running at the
0091  * maximum frequency on the highest capacity CPU of the system. For example, a
0092  * 20% utilization task is a task running for 2ms every 10ms at maximum
0093  * frequency.
0094  *
0095  * A task with a min utilization value bigger than 0 is more likely scheduled
0096  * on a CPU with a capacity big enough to fit the specified value.
0097  * A task with a max utilization value smaller than 1024 is more likely
0098  * scheduled on a CPU with no more capacity than the specified value.
0099  *
0100  * A task utilization boundary can be reset by setting the attribute to -1.
0101  */
0102 struct sched_attr {
0103     __u32 size;
0104 
0105     __u32 sched_policy;
0106     __u64 sched_flags;
0107 
0108     /* SCHED_NORMAL, SCHED_BATCH */
0109     __s32 sched_nice;
0110 
0111     /* SCHED_FIFO, SCHED_RR */
0112     __u32 sched_priority;
0113 
0114     /* SCHED_DEADLINE */
0115     __u64 sched_runtime;
0116     __u64 sched_deadline;
0117     __u64 sched_period;
0118 
0119     /* Utilization hints */
0120     __u32 sched_util_min;
0121     __u32 sched_util_max;
0122 
0123 };
0124 
0125 #endif /* _UAPI_LINUX_SCHED_TYPES_H */