mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Venkatesh Pallipadi <venki@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>,
	Aaron Durbin <adurbin@google.com>, Paul Turner <pjt@google.com>,
	Yong Zhang <yong.zhang0@gmail.com>,
	Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org,
	Venkatesh Pallipadi <venki@google.com>
Subject: [PATCH 3/4] x86: Extend IPIless wake to C1_mwait and poll_idle
Date: Fri, 24 Feb 2012 14:33:19 -0800	[thread overview]
Message-ID: <1330122800-834-4-git-send-email-venki@google.com> (raw)
In-Reply-To: <1330122800-834-1-git-send-email-venki@google.com>

poll_idle(), mwait_idle() [which is used for C1 mwait] and any other
polling based idle loops can also use the IPIless wakeup logic added
with mwait_idle_with_hints() in the earlier patch.

Signed-off-by: Venkatesh Pallipadi <venki@google.com>
---
 arch/x86/kernel/process.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 99a8109..43bb0a5 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -22,6 +22,7 @@
 #include <asm/uaccess.h>
 #include <asm/i387.h>
 #include <asm/debugreg.h>
+#include <asm/ipiless_wake.h>
 
 struct kmem_cache *task_xstate_cachep;
 EXPORT_SYMBOL_GPL(task_xstate_cachep);
@@ -445,7 +446,8 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
 /* Default MONITOR/MWAIT with no hints, used for default C1 state */
 static void mwait_idle(void)
 {
-	if (!need_resched()) {
+	enter_ipiless_idle();
+	if (!is_ipiless_wakeup_pending()) {
 		trace_power_start(POWER_CSTATE, 1, smp_processor_id());
 		trace_cpu_idle(1, smp_processor_id());
 		if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
@@ -453,7 +455,7 @@ static void mwait_idle(void)
 
 		__monitor((void *)&current_thread_info()->flags, 0, 0);
 		smp_mb();
-		if (!need_resched())
+		if (!is_ipiless_wakeup_pending())
 			__sti_mwait(0, 0);
 		else
 			local_irq_enable();
@@ -461,6 +463,7 @@ static void mwait_idle(void)
 		trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
 	} else
 		local_irq_enable();
+	exit_ipiless_idle();
 }
 
 /*
@@ -470,13 +473,15 @@ static void mwait_idle(void)
  */
 static void poll_idle(void)
 {
+	enter_ipiless_idle();
 	trace_power_start(POWER_CSTATE, 0, smp_processor_id());
 	trace_cpu_idle(0, smp_processor_id());
 	local_irq_enable();
-	while (!need_resched())
+	while (!is_ipiless_wakeup_pending())
 		cpu_relax();
 	trace_power_end(smp_processor_id());
 	trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+	exit_ipiless_idle();
 }
 
 /*
-- 
1.7.7.3


  parent reply	other threads:[~2012-02-24 22:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24 22:33 [PATCH 0/4] Extend mwait idle to optimize away CAL and RES interrupts to an idle CPU -v2 Venkatesh Pallipadi
2012-02-24 22:33 ` [PATCH 1/4] tile, ia64, x86: TS_POLLING cleanup Venkatesh Pallipadi
2012-02-24 22:33 ` [PATCH 2/4] x86: Mwait idle optimization to avoid CAL+RES IPIs -v2 Venkatesh Pallipadi
2012-02-24 22:33 ` Venkatesh Pallipadi [this message]
2012-02-24 22:33 ` [PATCH 4/4] x86: Optimize try_ipiless_wakeup avoid idle task lookup Venkatesh Pallipadi
2012-02-27  7:32 ` [PATCH 0/4] Extend mwait idle to optimize away CAL and RES interrupts to an idle CPU -v2 Ingo Molnar
2012-02-27 18:21   ` 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=1330122800-834-4-git-send-email-venki@google.com \
    --to=venki@google.com \
    --cc=adurbin@google.com \
    --cc=andi@firstfloor.org \
    --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 \
    --cc=yong.zhang0@gmail.com \
    /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

Powered by JetHome