Re: [RFC patch] Use IPI_shortcut for lapic timer broadcast

From: Luming Yu
Date: Thu Jul 02 2009 - 22:04:57 EST


On Fri, Jul 3, 2009 at 8:23 AM, Pallipadi,
Venkatesh<venkatesh.pallipadi@xxxxxxxxx> wrote:
> On Tue, 2009-06-30 at 00:01 -0700, Luming Yu wrote:
>> Thanks for review. How about the following patch?
>>
>> /**The patch is enclosed in text attachment**
>> **Using web client to send the patch**
>> **below is for review, please apply attached Âpatch*/
>>
>>
>> Signed-off-by: Yu Luming <luming.yu@xxxxxxxxx>
>>
>> Âapic.c     |  Â5 ++++-
>> Âapic_flat_64.c | Â Â7 ++++++-
>> Â2 files changed, 10 insertions(+), 2 deletions(-)
>>
>>
>> --- linux-2.6.30-rc6/arch/x86/kernel/apic/apic.c.0 Â Â2009-06-29
>> 23:45:05.000000000 -0600
>> +++ linux-2.6.30-rc6/arch/x86/kernel/apic/apic.c   Â2009-06-30
>> 00:37:56.000000000 -0600
>> @@ -419,7 +419,10 @@
>> Âstatic void lapic_timer_broadcast(const struct cpumask *mask)
>> Â{
>> Â#ifdef CONFIG_SMP
>> - Â Â apic->send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
>> + Â Â if (unlikely(cpumask_weight(mask) == num_online_cpus() -1))
>> + Â Â Â Â Â Â apic->send_IPI_all(LOCAL_TIMER_VECTOR);
>> + Â Â else
>> + Â Â Â Â Â Â apic->send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
>> Â#endif
>> Â}
>
> I dont think it is a good idea to pay the penalty for cpumask_weight and
> num_online_cpus, for the more common tickless case to fix this problem
> with less common no tickeless case.

In NO_HZ, the lapic_timer_broadcast is rare thing too...

>
> We should be able to add an interface to get tick_nohz_enabled from
> tick-sched.c and use that instead.

If we use send_IPI_all just for NO_HZ is disabled, we will leave a corner case
here that lapic_timer_broadcast could be really really being actively used even
NO_HZ enabled... if this will never happen, I would agree with you..

Thanks,
LUming
--
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/