linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <srostedt@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Why we need to call cpu_idle() with preemption disabled
Date: Tue, 16 Mar 2010 17:01:54 +0800	[thread overview]
Message-ID: <1268730114.9552.34.camel@falcon> (raw)

Hi, Thomas

Just traced the preemption latency of 2.6.33-rt7 on my Yeeloong netbook
with the preemptoff tracer of Ftrace and found it is very big in
cpu_idle(), more than 1000 us.

And found that we have called cpu_idle() in init/main.c with preemption
disabled? why we need to do it? can we simply call it with preemption
enabled?

diff --git a/init/main.c b/init/main.c
index 48393c0..437ac34 100644
--- a/init/main.c
+++ b/init/main.c
@@ -428,9 +428,8 @@ static noinline void __init_refok rest_init(void)
         */
        init_idle_bootup_task(current);
        preempt_enable_and_schedule();
-       preempt_disable();
 
-       /* Call into cpu_idle with preempt disabled */
+       /* There is no reason for calling cpu_idle with preemption
disabled */
        cpu_idle();
 }

After removing that preempt_disable() and the related operations around
the calling to __schedule() in the cpu_idle(), the result becomes around
200 us, which is acceptable for I have enabled several Ftrace tracers.

Best Regards,
	Wu Zhangjin


             reply	other threads:[~2010-03-16  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16  9:01 Wu Zhangjin [this message]
2010-03-16 15:04 ` Why we need to call cpu_idle() with preemption disabled Steven Rostedt

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=1268730114.9552.34.camel@falcon \
    --to=wuzhangjin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srostedt@redhat.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).