From: Venki Pallipadi <venki@google.com>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Aaron Durbin <adurbin@google.com>, Paul Turner <pjt@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] Extend mwait idle to optimize away IPIs when possible
Date: Tue, 7 Feb 2012 13:39:46 -0800 [thread overview]
Message-ID: <CABeCy1YX7ps3sKAv_A0AtQfNc3WSdxrAPqLfdvSXTiea5JgPZA@mail.gmail.com> (raw)
In-Reply-To: <1328581451.29790.14.camel@sbsiddha-desk.sc.intel.com>
On Mon, Feb 6, 2012 at 6:24 PM, Suresh Siddha <suresh.b.siddha@intel.com> wrote:
> On Mon, 2012-02-06 at 12:42 -0800, Venkatesh Pallipadi wrote:
>> * Lower overhead on Async IPI send path. Measurements on Westmere based
>> systems show savings on "no wait" smp_call_function_single with idle
>> target CPU (as measured on the sender side).
>> local socket smp_call_func cost goes from ~1600 to ~1200 cycles
>> remote socket smp_call_func cost goes from ~2000 to ~1800 cycles
>
> Interesting that savings in the remote socket is less compared to the
> local socket.
Yes. I was not sure whether it has something to do with mwait/IPI
wakeups work in hardware or it has something to do with C-state the
target CPU is woken out of.
>
>> +int smp_need_ipi(int cpu)
>> +{
>> + int oldval;
>> +
>> + if (!system_using_cpu_idle_sync || cpu == smp_processor_id())
>> + return 1;
>> +
>> + oldval = atomic_cmpxchg(&per_cpu(cpu_idle_sync, cpu),
>> + CPU_STATE_IDLE, CPU_STATE_WAKING);
>
> To avoid too many cache line bounces for the case when the cpu is in the
> running state, we should do a read to check if the state is in idle
> before going ahead with the locked operation?
>
Agree. Will add it on patch refresh.
>> +
>> + if (oldval == CPU_STATE_RUNNING)
>> + return 1;
>> +
>> + if (oldval == CPU_STATE_IDLE) {
>> + set_tsk_ipi_pending(idle_task(cpu));
>> + atomic_set(&per_cpu(cpu_idle_sync, cpu), CPU_STATE_WOKENUP);
>> + }
>> +
>> + return 0;
>
> We should probably disable interrupts around this, otherwise any delay
> in transitioning to wokenup from waking will cause the idle cpu to be
> stuck for similar amount of time.
>
Makes sense. Will add that too.
Thanks,
Venki
> thanks,
> suresh
>
next prev parent reply other threads:[~2012-02-07 21:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 20:42 [RFC] Extend mwait idle to optimize away IPIs when possible Venkatesh Pallipadi
2012-02-06 21:02 ` Peter Zijlstra
2012-02-06 21:26 ` Venki Pallipadi
2012-02-07 0:26 ` David Daney
2012-02-07 1:24 ` H. Peter Anvin
2012-02-07 1:34 ` David Daney
2012-02-07 1:45 ` H. Peter Anvin
2012-02-07 2:03 ` Venki Pallipadi
2012-02-07 2:24 ` Suresh Siddha
2012-02-07 21:39 ` Venki Pallipadi [this message]
2012-02-08 6:51 ` Yong Zhang
2012-02-08 23:28 ` Venki Pallipadi
2012-02-09 2:18 ` Yong Zhang
2012-02-10 2:17 ` Venki Pallipadi
2012-02-13 5:27 ` Yong Zhang
2012-02-10 19:19 ` Peter Zijlstra
2012-02-11 2:11 ` Venki Pallipadi
2012-02-11 3:09 ` Peter Zijlstra
2012-02-13 5:34 ` Yong Zhang
2012-02-14 13:52 ` Peter Zijlstra
2012-02-15 1:39 ` Yong Zhang
2012-02-15 2:32 ` Venki Pallipadi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABeCy1YX7ps3sKAv_A0AtQfNc3WSdxrAPqLfdvSXTiea5JgPZA@mail.gmail.com \
--to=venki@google.com \
--cc=adurbin@google.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).