aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-06-27 05:54:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 20:32:46 -0400
commitb29739f902ee76a05493fb7d2303490fc75364f4 (patch)
tree1bf48dfb74752a7ef24a2a4a74c45da0aaec754b /include
parent77ba89c5cf28d5d98a3cae17f67a3e42b102cc25 (diff)
[PATCH] pi-futex: scheduler support for pi
Add framework to boost/unboost the priority of RT tasks. This consists of: - caching the 'normal' priority in ->normal_prio - providing a functions to set/get the priority of the task - make sched_setscheduler() aware of boosting The effective_prio() cleanups also fix a priority-calculation bug pointed out by Andrey Gelman, in set_user_nice(). has_rt_policy() fix: Peter Williams <pwil3058@bigpond.net.au> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Andrey Gelman <agelman@012.net.il> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/sched.h21
2 files changed, 21 insertions, 2 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index e127ef7e8da8..678c1a90380d 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -87,6 +87,7 @@ extern struct group_info init_groups;
87 .lock_depth = -1, \ 87 .lock_depth = -1, \
88 .prio = MAX_PRIO-20, \ 88 .prio = MAX_PRIO-20, \
89 .static_prio = MAX_PRIO-20, \ 89 .static_prio = MAX_PRIO-20, \
90 .normal_prio = MAX_PRIO-20, \
90 .policy = SCHED_NORMAL, \ 91 .policy = SCHED_NORMAL, \
91 .cpus_allowed = CPU_MASK_ALL, \ 92 .cpus_allowed = CPU_MASK_ALL, \
92 .mm = NULL, \ 93 .mm = NULL, \
@@ -122,6 +123,7 @@ extern struct group_info init_groups;
122 .journal_info = NULL, \ 123 .journal_info = NULL, \
123 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 124 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
124 .fs_excl = ATOMIC_INIT(0), \ 125 .fs_excl = ATOMIC_INIT(0), \
126 .pi_lock = SPIN_LOCK_UNLOCKED, \
125} 127}
126 128
127 129
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0bc81a151e50..6f167645e7e2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -495,8 +495,11 @@ struct signal_struct {
495 495
496#define MAX_PRIO (MAX_RT_PRIO + 40) 496#define MAX_PRIO (MAX_RT_PRIO + 40)
497 497
498#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) 498#define rt_prio(prio) unlikely((prio) < MAX_RT_PRIO)
499#define rt_task(p) rt_prio((p)->prio)
499#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH)) 500#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
501#define has_rt_policy(p) \
502 unlikely((p)->policy != SCHED_NORMAL && (p)->policy != SCHED_BATCH)
500 503
501/* 504/*
502 * Some day this will be a full-fledged user tracking system.. 505 * Some day this will be a full-fledged user tracking system..
@@ -725,7 +728,7 @@ struct task_struct {
725#endif 728#endif
726#endif 729#endif
727 int load_weight; /* for niceness load balancing purposes */ 730 int load_weight; /* for niceness load balancing purposes */
728 int prio, static_prio; 731 int prio, static_prio, normal_prio;
729 struct list_head run_list; 732 struct list_head run_list;
730 prio_array_t *array; 733 prio_array_t *array;
731 734
@@ -852,6 +855,9 @@ struct task_struct {
852/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 855/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
853 spinlock_t alloc_lock; 856 spinlock_t alloc_lock;
854 857
858 /* Protection of the PI data structures: */
859 spinlock_t pi_lock;
860
855#ifdef CONFIG_DEBUG_MUTEXES 861#ifdef CONFIG_DEBUG_MUTEXES
856 /* mutex deadlock detection */ 862 /* mutex deadlock detection */
857 struct mutex_waiter *blocked_on; 863 struct mutex_waiter *blocked_on;
@@ -1018,6 +1024,17 @@ static inline void idle_task_exit(void) {}
1018#endif 1024#endif
1019 1025
1020extern void sched_idle_next(void); 1026extern void sched_idle_next(void);
1027
1028#ifdef CONFIG_RT_MUTEXES
1029extern int rt_mutex_getprio(task_t *p);
1030extern void rt_mutex_setprio(task_t *p, int prio);
1031#else
1032static inline int rt_mutex_getprio(task_t *p)
1033{
1034 return p->normal_prio;
1035}
1036#endif
1037
1021extern void set_user_nice(task_t *p, long nice); 1038extern void set_user_nice(task_t *p, long nice);
1022extern int task_prio(const task_t *p); 1039extern int task_prio(const task_t *p);
1023extern int task_nice(const task_t *p); 1040extern int task_nice(const task_t *p);