[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH, RFC] x86/HVM: batch vCPU wakeups



On 10/09/14 11:29, Tim Deegan wrote:
> At 23:37 +0100 on 09 Sep (1410302243), Andrew Cooper wrote:
>>>> +void cpu_raise_softirq_batch_finish(void)
>>>> +{
>>>> +    unsigned int cpu, this_cpu = smp_processor_id();
>>>> +    cpumask_t *mask = &per_cpu(batch_mask, this_cpu);
>>> Again, this_cpu()?
>> ...But disagree here.  Multiple uses of this_cpu($FOO) cannot be
>> coalesced due to RELOC_HIDE() deliberately preventing optimisation.  For
>> multiple uses, pulling it out by pointer to start with results in rather
>> more efficient code.
> I wasn't questioning the pointer, but to the use of per_cpu(...,
> this_cpu) instead of this_cpu(...).  Both of those involve a
> RELOC_HIDE().
>
> Anyway, it's pretty clear from your and Jan's replies that multiple
> this_cpu() invocations are slower -- thanks for the clarification!
>
> Tim.

The difference (if any) between per_cpu() vs this_cpu() depends on
whether the compiler decides to recalculate smp_processor_id() or not. 
The former is manual optimisation on behalf of the programmer.

I am beginning to wonder whether the use of __attribute__((const)) might
help with get_cpu_info().  Despite the explicit stack pointer reference
which is undoubtedly the source of optimisation confusion for the
compiler, inside a function, the result of get_cpu_info() is genuinely
never going to change, even though the compiler can't necessarily prove
the fact.

~Andrew


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.