[PATCH] sched: fix conflict of schedule domain balance in RT scheduling

From: Hillf Danton
Date: Wed Jun 01 2011 - 09:59:00 EST


SD_BALANCE_WAKE and SD_WAKE_AFFINE are defined to be mutually exclusive, and
are checked in select_task_rq_rt() and find_lowest_rq() respectively.

The target cpu that is elected only from schedule domains of SD_WAKE_AFFINE if
CPU topology concerned, conflicts with the SD_BALANCE_WAKE requirement.

And checking for cache-hot is also added to confirm the comment there.

Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
---
kernel/sched_rt.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 88725c9..87c44e6 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1005,7 +1005,7 @@ select_task_rq_rt(struct task_struct *p, int
sd_flag, int flags)
struct rq *rq;
int cpu;

- if (sd_flag != SD_BALANCE_WAKE)
+ if (!(sd_flag & SD_BALANCE_WAKE))
return smp_processor_id();

cpu = task_cpu(p);
@@ -1253,7 +1253,8 @@ static int find_lowest_rq(struct task_struct *task)
* We prioritize the last cpu that the task executed on since
* it is most likely cache-hot in that location.
*/
- if (cpumask_test_cpu(cpu, lowest_mask))
+ if (cpumask_test_cpu(cpu, lowest_mask) &&
+ task_hot(task, task_rq(task)->clock_task, NULL))
return cpu;

/*
@@ -1265,7 +1266,7 @@ static int find_lowest_rq(struct task_struct *task)

rcu_read_lock();
for_each_domain(cpu, sd) {
- if (sd->flags & SD_WAKE_AFFINE) {
+ if (sd->flags & (SD_WAKE_AFFINE | SD_BALANCE_WAKE)) {
int best_cpu;

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