From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 2/2] nohz: Avoid tick's double reprogramming in highres mode
Date: Fri, 22 Aug 2014 19:09:33 +0200 [thread overview]
Message-ID: <1408727373-8166-3-git-send-email-frederic@kernel.org> (raw)
In-Reply-To: <1408727373-8166-1-git-send-email-frederic@kernel.org>
From: Viresh Kumar <viresh.kumar@linaro.org>
In highres mode, the tick reschedules itself unconditionally to the
next jiffies.
However while this clock reprogramming is relevant when the tick is
in periodic mode, it's not that interesting when we run in dynticks mode
because irq exit is likely going to overwrite the next tick to some
randomly deferred future.
So lets just get rid of this tick self rescheduling in dynticks mode.
This way we can avoid some clockevents double write in favourable
scenarios like when we stop the tick completely in idle while no other
hrtimer is pending.
Suggested-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/time/tick-sched.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 153870a..cc0a5b6 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -1099,6 +1099,10 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
if (regs)
tick_sched_handle(ts, regs);
+ /* No need to reprogram if we are in idle or full dynticks mode */
+ if (unlikely(ts->tick_stopped))
+ return HRTIMER_NORESTART;
+
hrtimer_forward(timer, now, tick_period);
return HRTIMER_RESTART;
--
2.1.0
next prev parent reply other threads:[~2014-08-22 17:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-22 17:09 [GIT PULL] nohz: Fix double clock write on idle ticks Frederic Weisbecker
2014-08-22 17:09 ` [PATCH 1/2] nohz: Fix spurious periodic tick behaviour in low-res dynticks mode Frederic Weisbecker
2014-08-22 17:09 ` Frederic Weisbecker [this message]
2014-08-24 10:07 ` [GIT PULL] nohz: Fix double clock write on idle ticks Ingo Molnar
[not found] ` <CAFTL4hz8OELwXZ603UUWZQwOQE677CBeS37rB9F1OYNuM9ByOA@mail.gmail.com>
2014-08-24 14:45 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2014-07-31 16:45 [PATCH 0/2] nohz: Avoid double clock write Frederic Weisbecker
2014-07-31 16:45 ` [PATCH 2/2] nohz: Avoid tick's double reprogramming in highres mode Frederic Weisbecker
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=1408727373-8166-3-git-send-email-frederic@kernel.org \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.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