From: Leon Ma <xindong.ma@intel.com>
To: tglx@linutronix.de, linux-kernel@vger.kernel.org
Cc: Leon Ma <xindong.ma@intel.com>
Subject: [PATCH] hrtimer:do not start hrtimer on other cpu if it is the leftmost timer.
Date: Wed, 30 Apr 2014 16:43:10 +0800 [thread overview]
Message-ID: <1398847391-5994-1-git-send-email-xindong.ma@intel.com> (raw)
On SMP system, if cpuX is idle and it starts an hrtimer, the timer
will be started on cpuY. But it can not reprogram the event source
on cpuY. The timer is inserted into rb tree of cpuY, if it is the
leftmost timer on cpuY and it is a very short timer, following hrtimers
started on cpuY will also not set the event source. As a result,
the timers on cpuY will expire later than expected.
When this case is detected, we should start the timer on cpuX and
program event source properly.
Signed-off-by: Leon Ma <xindong.ma@intel.com>
---
kernel/hrtimer.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index d55092c..68becbc 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -234,6 +234,11 @@ again:
goto again;
}
timer->base = new_base;
+ } else {
+ if (cpu != this_cpu && hrtimer_check_target(timer, new_base)) {
+ cpu = this_cpu;
+ goto again;
+ }
}
return new_base;
}
--
1.7.9.5
next reply other threads:[~2014-04-30 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 8:43 Leon Ma [this message]
2014-04-30 10:35 ` Viresh Kumar
2014-04-30 12:29 ` Ma, Xindong
2014-04-30 10:37 ` [tip:timers/urgent] hrtimer: Prevent remote enqueue of leftmost timers tip-bot for Leon Ma
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=1398847391-5994-1-git-send-email-xindong.ma@intel.com \
--to=xindong.ma@intel.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®