From: Arjan van de Ven <arjan@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, x86@kernel.org, arjanvandeven@gmail.com
Subject: x86: clean up smpboot.c's use of udelay+schedule
Date: Mon, 30 Jan 2012 20:53:04 -0800 [thread overview]
Message-ID: <20120130205304.0e10b05e@infradead.org> (raw)
>From 9f8dd2b15ff19ad73ee0eb235b4fdde9277185e8 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Mon, 30 Jan 2012 20:38:09 -0800
Subject: [PATCH] x86: clean up smpboot.c's use of udelay+schedule
smpboot.c does a udelay() followed by a schedule(); to yield
the CPU to other threads. This comes from the time when the kernel
did not yet have usleep_*() style APIs...
... nowadays, the kernel can do better than this, and this
patch replaces this code sequence with a usleep_range(),
so that the CPU is actually yielded for some real time.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
arch/x86/kernel/smpboot.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 66d250c..0b794c6 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -781,14 +781,13 @@ do_rest:
for (timeout = 0; timeout < 50000; timeout++) {
if (cpumask_test_cpu(cpu, cpu_callin_mask))
break; /* It has booted */
- udelay(100);
/*
* Allow other tasks to run while we wait for the
* AP to come online. This also gives a chance
* for the MTRR work(triggered by the AP coming online)
* to be completed in the stop machine context.
*/
- schedule();
+ usleep_range(100, 200);
}
if (cpumask_test_cpu(cpu, cpu_callin_mask))
--
1.7.6.4
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next reply other threads:[~2012-01-31 4:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-31 4:53 Arjan van de Ven [this message]
2012-01-31 12:43 ` x86: clean up smpboot.c's use of udelay+schedule Ingo Molnar
2012-01-31 12:47 ` Peter Zijlstra
2012-01-31 12:53 ` Ingo Molnar
2012-01-31 13:01 ` Peter Zijlstra
2012-02-02 0:33 ` Paul E. McKenney
2012-02-02 8:03 ` Srivatsa S. Bhat
2012-02-02 15:23 ` Paul E. McKenney
2012-02-03 17:32 ` Paul E. McKenney
2012-01-31 13:43 ` Arjan van de Ven
2012-01-31 13:32 ` Arjan van de Ven
2012-01-31 14:30 ` Ingo Molnar
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=20120130205304.0e10b05e@infradead.org \
--to=arjan@infradead.org \
--cc=arjanvandeven@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=x86@kernel.org \
/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).