LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mike Galbraith <bitbucket@online.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Len Brown <lenb@kernel.org>,
	x86@kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
	Ian Malone <ibmalone@gmail.com>, Josh Boyer <jwboyer@redhat.com>,
	stable@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH REGRESSION FIX] x86 idle: restore mwait_idle()
Date: Sat, 18 Jan 2014 17:14:44 +0100	[thread overview]
Message-ID: <1390061684.5566.4.camel@marge.simpson.net> (raw)
In-Reply-To: <1390037633.5676.3.camel@marge.simpson.net>

On Sat, 2014-01-18 at 10:33 +0100, Mike Galbraith wrote: 
> On Fri, 2014-01-17 at 05:20 +0100, Mike Galbraith wrote:
> 
> > taskset 0xc pipe-test 1
> > 
> > 3.8.13     3.397977 usecs/loop -- avg 3.400336 588.2 KHz
> > master+    4.798547 usecs/loop -- avg 4.791692 417.4 KHz
> 
> Bah, those are apple/grape, these are apple/apple.

Or, to make it more correct for 3.10..13, add the clflush barriers as
well for afflicted CPUs.

idle: kill unnecessary mwait_idle() resched IPIs

Set/clear polling instead.

Q6600, pipe-test scheduling cross core:
3.8.13                   487.2 KHz    1.000
3.13.0-master            415.5 KHz     .852
3.13.0-master+           415.2 KHz     .852     + restore mwait_idle
3.13.0-master++          488.5 KHz    1.002     + restore mwait_idle + IPI fix

Signed-off-by: Mike Galbraith <bitbucket@online.de>
Cc: <stable@vger.kernel.org> # 3.10+
---
 arch/x86/kernel/process.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -427,18 +427,21 @@ static int prefer_mwait_c1_over_halt(con
 
 static void mwait_idle(void)
 {
-	if (!need_resched()) {
-		if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
+	if (!current_set_polling_and_test()) {
+		if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) {
+			mb();
 			clflush((void *)&current_thread_info()->flags);
+			mb();
+		}
 
 		__monitor((void *)&current_thread_info()->flags, 0, 0);
-		smp_mb();
 		if (!need_resched())
 			__sti_mwait(0, 0);
 		else
 			local_irq_enable();
 	} else
 		local_irq_enable();
+	__current_clr_polling();
 }
 
 void select_idle_routine(const struct cpuinfo_x86 *c)



  reply	other threads:[~2014-01-18 16:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1ae2a8af42281d6b9888ac8c76bab7bd2f431d44.1389763084.git.len.brown@intel.com>
2014-01-15  5:37 ` Len Brown
2014-01-15  9:28   ` Mike Galbraith
2014-01-16 22:00   ` Andy Lutomirski
2014-01-17  4:20     ` Mike Galbraith
2014-01-18  9:33       ` Mike Galbraith
2014-01-18 16:14         ` Mike Galbraith [this message]
2015-03-14 23:44           ` Ian Malone
2015-03-15  4:53             ` Mike Galbraith
2015-03-16 23:32               ` Ian Malone
2015-03-17  8:22                 ` Ingo Molnar
2015-03-17  8:33                   ` Mike Galbraith
2015-03-18  1:55                   ` Ian Malone
2015-03-16 12:11           ` [tip:sched/core] sched/idle/x86: Optimize unnecessary mwait_idle( ) resched IPIs tip-bot for Mike Galbraith
2015-03-16 12:11   ` [tip:sched/core] sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance tip-bot for Len Brown

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=1390061684.5566.4.camel@marge.simpson.net \
    --to=bitbucket@online.de \
    --cc=ibmalone@gmail.com \
    --cc=jwboyer@redhat.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH REGRESSION FIX] x86 idle: restore mwait_idle()' \
    /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

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).