]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/linux/sched/prio.h
Merge branch 'linus' into sched/core
[mirror_ubuntu-artful-kernel.git] / include / linux / sched / prio.h
1 #ifndef _SCHED_PRIO_H
2 #define _SCHED_PRIO_H
3
4 /*
5 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
6 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
7 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
8 * values are inverted: lower p->prio value means higher priority.
9 *
10 * The MAX_USER_RT_PRIO value allows the actual maximum
11 * RT priority to be separate from the value exported to
12 * user-space. This allows kernel threads to set their
13 * priority to a value higher than any user task. Note:
14 * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
15 */
16
17 #define MAX_USER_RT_PRIO 100
18 #define MAX_RT_PRIO MAX_USER_RT_PRIO
19
20 #define MAX_PRIO (MAX_RT_PRIO + 40)
21 #define DEFAULT_PRIO (MAX_RT_PRIO + 20)
22
23 /*
24 * Convert user-nice values [ -20 ... 0 ... 19 ]
25 * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
26 * and back.
27 */
28 #define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
29 #define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
30
31 /*
32 * 'User priority' is the nice value converted to something we
33 * can work with better when scaling various scheduler parameters,
34 * it's a [ 0 ... 39 ] range.
35 */
36 #define USER_PRIO(p) ((p)-MAX_RT_PRIO)
37 #define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio)
38 #define MAX_USER_PRIO (USER_PRIO(MAX_PRIO))
39
40 #endif /* _SCHED_PRIO_H */