public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Arve Hjønnevåg" <arve@android.com>
To: linux-arm-kernel@lists.arm.linux.org.uk, linux-kernel@vger.kernel.org
Cc: swetland@google.com, "Arve Hjønnevåg" <arve@android.com>
Subject: [PATCH] nohz: Fix ondemand governor not always ramping up on 100% load.
Date: Fri, 29 May 2009 22:00:19 -0700	[thread overview]
Message-ID: <1243659619-9675-1-git-send-email-arve@android.com> (raw)

On systems that perform the context switch with interrupts enabled
(e.g. ARM) get_cpu_idle_time_us could get stuck returning the last
idle time when the cpu is busy. If an interrupt occurs while
switching to the idle thread, and this interrupt wakes up a thread,
need-resched will be set on the idle thread, but since we have not
finished switching to the idle thread tick_nohz_stop_sched_tick will
be called. (idle_cpu is true since the head of the runqueue is the
idle thread, but need_resched returns false since we are still
running in the context of the old thread)

Fix this by not calling tick_nohz_start_idle when returning from an
interrupt while the idle thread is in its schedule phase.
(!ts->inidle)

Signed-off-by: Arve Hjønnevåg <arve@android.com>
---
 kernel/time/tick-sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index d3f1ef4..4012da6 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -222,7 +222,6 @@ void tick_nohz_stop_sched_tick(int inidle)
 
 	cpu = smp_processor_id();
 	ts = &per_cpu(tick_cpu_sched, cpu);
-	now = tick_nohz_start_idle(ts);
 
 	/*
 	 * If this cpu is offline and it is the one which updates
@@ -242,6 +241,7 @@ void tick_nohz_stop_sched_tick(int inidle)
 	if (!inidle && !ts->inidle)
 		goto end;
 
+	now = tick_nohz_start_idle(ts);
 	ts->inidle = 1;
 
 	if (need_resched())
-- 
1.6.1


                 reply	other threads:[~2009-05-30  5:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1243659619-9675-1-git-send-email-arve@android.com \
    --to=arve@android.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swetland@google.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