Re: [PATCH 5/6] sched: Remove irq time from available CPU power

From: Venkatesh Pallipadi
Date: Mon Sep 20 2010 - 13:39:29 EST


On Sun, Sep 19, 2010 at 4:31 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Thu, 2010-09-16 at 18:56 -0700, Venkatesh Pallipadi wrote:
>> +++ b/kernel/sched.c
>> @@ -2025,6 +2025,18 @@ static u64 unaccount_irq_delta(u64 delta, int cpu, u64 *saved_irq_time)
>>  #define unaccount_irq_delta_rt(delta, cpu, class_rq)            \
>>                 unaccount_irq_delta(delta, cpu, &(class_rq)->saved_irq_time)
>>
>> +static void sched_irq_power_update_fair(int cpu, struct cfs_rq *cfs_rq,
>> +                       struct rq* rq)
>> +{
>> +       if (!sched_clock_irqtime)
>> +               return;
>> +
>> +       if (likely(rq->total_irq_time > cfs_rq->saved_irq_time)) {
>> +               sched_rt_avg_update(rq,
>> +                               rq->total_irq_time - cfs_rq->saved_irq_time);
>> +       }
>> +}
>> +
>>  #else
>>
>>  #define update_irq_time(cpu, crq)              do { } while (0)
>> @@ -2042,6 +2054,8 @@ static u64 unaccount_irq_delta_rt(u64 delta_exec, int cpu, struct rt_rq *rt_rq)
>>         return delta_exec;
>>  }
>>
>> +#define sched_irq_power_update_fair(cpu, crq, rq)      do { } while (0)
>> +
>>  #endif
>>
>>  #include "sched_idletask.c"
>> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
>> index a64fdaf..937fded 100644
>> --- a/kernel/sched_fair.c
>> +++ b/kernel/sched_fair.c
>> @@ -526,6 +526,9 @@ static void update_curr(struct cfs_rq *cfs_rq)
>>         if (unlikely(!curr))
>>                 return;
>>
>> +       if (sched_feat(NONIRQ_POWER) && entity_is_task(curr))
>> +               sched_irq_power_update_fair(cpu, cfs_rq, rq_of(cfs_rq));
>> +
>>         /*
>>          * Get the amount of time the current task was running
>>          * since the last time we changed load (this cannot
>
> This all looks very confusing to me,.. How about we simply fold the
> delta between rq->clock and rq->clock_task into sched_rt_avg_update()
> and be done with it?
>

rq->clock and rq->clock_task: As I understood, you mean having both
being continuous counters since boot. So, we will still need some
"rt_avg_accounted irq_time" that will be updated when
sched_rt_avg_update() is done. Or am I missing something?

Thanks.
Venki
--
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/