Skip to content

Commit

Permalink
sched: push RT tasks from overloaded CPUs
Browse files Browse the repository at this point in the history
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 <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Jan 25, 2008
1 parent f65eda4 commit 4642daf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)

out_running:
p->state = TASK_RUNNING;
wakeup_balance_rt(rq, p);
out:
task_rq_unlock(rq, &flags);

Expand Down
10 changes: 10 additions & 0 deletions kernel/sched_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,15 @@ static void schedule_tail_balance_rt(struct rq *rq)
}
}


static void wakeup_balance_rt(struct rq *rq, struct task_struct *p)
{
if (unlikely(rt_task(p)) &&
!task_running(rq, p) &&
(p->prio >= rq->curr->prio))
push_rt_tasks(rq);
}

/*
* Load-balancing iterator. Note: while the runqueue stays locked
* during the whole iteration, the current task might be
Expand Down Expand Up @@ -665,6 +674,7 @@ move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
#else /* CONFIG_SMP */
# define schedule_tail_balance_rt(rq) do { } while (0)
# define schedule_balance_rt(rq, prev) do { } while (0)
# define wakeup_balance_rt(rq, p) do { } while (0)
#endif /* CONFIG_SMP */

static void task_tick_rt(struct rq *rq, struct task_struct *p)
Expand Down

0 comments on commit 4642daf

Please sign in to comment.