[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BANLkTinbFTdr3ckV86CHBTYoYQQkE3eCsg@mail.gmail.com>
Date: Thu, 19 May 2011 20:49:04 +0800
From: Hillf Danton <dhillf@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Yong Zhang <yong.zhang0@...il.com>,
LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
Mike Galbraith <efault@....de>
Subject: [PATCH resend] sched: correct how RT task is picked
When picking RT task for given runqueue and CPU, if CPU is less than
zero, then the check for task's CPU affinity is bypassed, which
creates incorrect result if the number of CPUs for the task to run is
bigger than one.
And lets check the case that CPU is not less than zero, if CPU is in
the mask of cpus_allowed and if CPU == rq->cpu, incorrect result could
also be reached if the number of CPUs for the task to run is not
bigger than one.
On the other hand, if CPU is in the mask of cpus_allowed and if CPU !=
rq->cpu, checking nr_cpus_allowed is overwork since it is computed
based on cpus_allowed as seen in set_cpus_allowed_rt().
In the patch the checks for both CPU and nr_cpus_allowed are removed
for correct results in the case that CPU is different from rq->cpu and
in the case that CPU is not.
Signed-off-by: Hillf Danton <dhillf@...il.com>
Acked-by: Steven Rostedt <rostedt@...dmis.org>
---
--- a/kernel/sched_rt.c 2011-04-27 11:48:50.000000000 +0800
+++ b/kernel/sched_rt.c 2011-05-19 20:05:46.000000000 +0800
@@ -1149,11 +1149,8 @@ static void deactivate_task(struct rq *r
static int pick_rt_task(struct rq *rq, struct task_struct *p, int cpu)
{
- if (!task_running(rq, p) &&
- (cpu < 0 || cpumask_test_cpu(cpu, &p->cpus_allowed)) &&
- (p->rt.nr_cpus_allowed > 1))
- return 1;
- return 0;
+ return !task_running(rq, p) &&
+ cpumask_test_cpu(cpu, &p->cpus_allowed);
}
/* Return the second highest RT task, NULL otherwise */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists