Re: [PATCH] sched: fix wrong rq's runnable_avg update with rt task
From: Vincent Guittot
Date: Fri Feb 08 2013 - 10:06:01 EST
On 8 February 2013 15:46, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Fri, 2013-02-08 at 12:11 +0100, Vincent Guittot wrote:
>> When a RT task is scheduled on an idle CPU, the update of the rq's load is
>> not done because CFS's functions are not called. Then, the idle_balance,
>> which is called just before entering the idle function, updates the
>> rq's load and makes the assumption that the elapsed time since the last
>> update, was only running time.
>> The rq's load of a CPU that only runs a periodic RT task, is close to
>> LOAD_AVG_MAX whatever the running duration of the RT task is.
>> A new idle_exit function is called when the prev task is the idle function
>> so the elapsed time will be accounted as idle time in the rq's load.
>> Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
>> kernel/sched/core.c | 3 +++
>> kernel/sched/fair.c | 10 ++++++++++
>> kernel/sched/sched.h | 5 +++++
>> 3 files changed, 18 insertions(+)
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 26058d0..592e06c 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -2927,6 +2927,9 @@ need_resched:
>> pre_schedule(rq, prev);
>> + if (unlikely(prev == rq->idle))
>> + idle_exit(cpu, rq);
> Let's get rid of the added junk in the core code that should be isolated
> in the idle code.
> I posted these patches before, and I'm about to post again:
> I'm working to clean these patches up today and post them again. Would
> working on top of these work for you?
yes for sure.
I will move that code in pre_schedule
> -- Steve
>> if (unlikely(!rq->nr_running))
>> idle_balance(cpu, rq);
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/