Re: [PATCH 1/6] Free up pf flag PF_KSOFTIRQD

From: Venkatesh Pallipadi
Date: Thu Oct 21 2010 - 13:06:45 EST


On Thu, Oct 21, 2010 at 8:13 AM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> On Wed, 20 Oct 2010, Venkatesh Pallipadi wrote:
>
>> diff --git a/kernel/sched.c b/kernel/sched.c
>> index abf8440..5d4afe9 100644
>> --- a/kernel/sched.c
>> +++ b/kernel/sched.c
>> @@ -1984,9 +1984,9 @@ void account_system_vtime(struct task_struct *curr)
>>        * in that case, so as not to confuse scheduler with a special task
>>        * that do not consume any time, but still wants to run.
>>        */
>> -     if (hardirq_count())
>> +     if (in_irq())
>>               per_cpu(cpu_hardirq_time, cpu) += delta;
>
> If cpu is always the current cpu then you can optimize the code:
>
>        this_cpu_add(cpu_hardirq_time, delta)
>
>> -     else if (in_serving_softirq() && !(curr->flags & PF_KSOFTIRQD))
>> +     else if (in_serving_softirq() && !(is_ksoftirqd_context()))
>>               per_cpu(cpu_softirq_time, cpu) += delta;
>
> Same here.
>

Yes. this_cpu_* variants were my learning of the day for today :-).
Will cleanup various per_cpu() and __get_cpu_var() when I refresh this
patchset.

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/