This patch adds pushing of overloaded RT tasks from a runqueue that is
having tasks (most likely RT tasks) added to the run queue.

TODO: We don't cover the case of waking of new RT tasks (yet).

Signed-off-by: Steven Rostedt <[EMAIL PROTECTED]>
---
 kernel/sched.c    |    2 ++
 kernel/sched_rt.c |   12 ++++++++++++
 2 files changed, 14 insertions(+)

Index: linux-test.git/kernel/sched_rt.c
===================================================================
--- linux-test.git.orig/kernel/sched_rt.c       2007-10-22 22:37:28.000000000 
-0400
+++ linux-test.git/kernel/sched_rt.c    2007-10-22 22:38:04.000000000 -0400
@@ -559,9 +559,21 @@ static void schedule_tail_balance_rt(str
                spin_unlock_irq(&rq->lock);
        }
 }
+
+static void wakeup_balance_rt(struct rq *rq, struct task_struct *p)
+{
+       if (unlikely(rt_task(p)) &&
+           (p->prio >= rq->curr->prio)) {
+               /* pull_rt_task needs task to be running */
+               p->state = TASK_RUNNING;
+               push_rt_tasks(rq);
+       }
+}
+
 #else /* CONFIG_SMP */
 # define schedule_tail_balance_rt(rq)  do { } while (0)
 # define schedule_balance_rt(rq)       do { } while (0)
+# define wakeup_balance_rt(rq, p)      do { } while (0)
 #endif /* CONFIG_SMP */
 
 
Index: linux-test.git/kernel/sched.c
===================================================================
--- linux-test.git.orig/kernel/sched.c  2007-10-22 22:37:28.000000000 -0400
+++ linux-test.git/kernel/sched.c       2007-10-22 22:38:04.000000000 -0400
@@ -22,6 +22,7 @@
  *              by Peter Williams
  *  2007-05-06  Interactivity improvements to CFS by Mike Galbraith
  *  2007-07-01  Group scheduling enhancements by Srivatsa Vaddagiri
+ *  2007-10-22  RT overload balancing by Steven Rostedt
  */
 
 #include <linux/mm.h>
@@ -1614,6 +1615,7 @@ out_activate:
        update_rq_clock(rq);
        activate_task(rq, p, 1);
        check_preempt_curr(rq, p);
+       wakeup_balance_rt(rq, p);
        success = 1;
 
 out_running:

-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to