aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-07-09 12:51:59 -0400
committerIngo Molnar <mingo@elte.hu>2007-07-09 12:51:59 -0400
commite05606d3301525aa67b081ad9fccade2b31ab35a (patch)
tree2a3e5a477dfca70ce32f3ea8dbc5e16034c98c23 /include
parent138a8aeb5b9e5c5abd5e5ec22b6d1848e7e9c50b (diff)
sched: clean up the rt priority macros
clean up the rt priority macros, pointed out by Andrew Morton. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h61
1 files changed, 36 insertions, 25 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3e7f1890e55d..4dcc61cca00a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -525,31 +525,6 @@ struct signal_struct {
525#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ 525#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */
526#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ 526#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */
527 527
528
529/*
530 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
531 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
532 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
533 * values are inverted: lower p->prio value means higher priority.
534 *
535 * The MAX_USER_RT_PRIO value allows the actual maximum
536 * RT priority to be separate from the value exported to
537 * user-space. This allows kernel threads to set their
538 * priority to a value higher than any user task. Note:
539 * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
540 */
541
542#define MAX_USER_RT_PRIO 100
543#define MAX_RT_PRIO MAX_USER_RT_PRIO
544
545#define MAX_PRIO (MAX_RT_PRIO + 40)
546
547#define rt_prio(prio) unlikely((prio) < MAX_RT_PRIO)
548#define rt_task(p) rt_prio((p)->prio)
549#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
550#define is_rt_policy(p) ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)
551#define has_rt_policy(p) unlikely(is_rt_policy((p)->policy))
552
553/* 528/*
554 * Some day this will be a full-fledged user tracking system.. 529 * Some day this will be a full-fledged user tracking system..
555 */ 530 */
@@ -1164,6 +1139,42 @@ struct task_struct {
1164#endif 1139#endif
1165}; 1140};
1166 1141
1142/*
1143 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
1144 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
1145 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
1146 * values are inverted: lower p->prio value means higher priority.
1147 *
1148 * The MAX_USER_RT_PRIO value allows the actual maximum
1149 * RT priority to be separate from the value exported to
1150 * user-space. This allows kernel threads to set their
1151 * priority to a value higher than any user task. Note:
1152 * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
1153 */
1154
1155#define MAX_USER_RT_PRIO 100
1156#define MAX_RT_PRIO MAX_USER_RT_PRIO
1157
1158#define MAX_PRIO (MAX_RT_PRIO + 40)
1159#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
1160
1161static inline int rt_prio(int prio)
1162{
1163 if (unlikely(prio < MAX_RT_PRIO))
1164 return 1;
1165 return 0;
1166}
1167
1168static inline int rt_task(struct task_struct *p)
1169{
1170 return rt_prio(p->prio);
1171}
1172
1173static inline int batch_task(struct task_struct *p)
1174{
1175 return p->policy == SCHED_BATCH;
1176}
1177
1167static inline pid_t process_group(struct task_struct *tsk) 1178static inline pid_t process_group(struct task_struct *tsk)
1168{ 1179{
1169 return tsk->signal->pgrp; 1180 return tsk->signal->pgrp;