lkml.org 
[lkml]   [2014]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 27/38] tick-sched: remove 'regs' parameter of tick_sched_handle()
Date
tick_sched_handle() is called from two places and both pass 'regs' to it almost
same way. This patch removes this parameter to tick_sched_handle() and updates
tick_sched_handle() to get that by itself.

The only point of difference in the way this routine was called from its callers
was, don't call it from process context. To make sure the nohz path doesn't
suffer from an additional branch instruction, add unlikely to the if()
statement.

Though I still don't understand when will we run tick_sched_timer() from process
context. I couldn't see a single instance of that happening on my test machine
for normal boot followed by some userspace operations.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
kernel/time/tick-sched.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index bff7f97..ee0768b 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -129,8 +129,17 @@ static void tick_sched_do_timer(ktime_t now)
tick_do_update_jiffies64(now);
}

-static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs)
+static void tick_sched_handle(struct tick_sched *ts)
{
+ struct pt_regs *regs = get_irq_regs();
+
+ /*
+ * Do not call, when we are not in irq context and have
+ * no valid regs pointer
+ */
+ if (unlikely(!regs))
+ return;
+
#ifdef CONFIG_NO_HZ_COMMON
/*
* When we are idle and the tick is stopped, we have to touch
@@ -942,13 +951,12 @@ static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now)
static void tick_nohz_handler(struct clock_event_device *dev)
{
struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
- struct pt_regs *regs = get_irq_regs();
ktime_t now = ktime_get();

dev->next_event.tv64 = KTIME_MAX;

tick_sched_do_timer(now);
- tick_sched_handle(ts, regs);
+ tick_sched_handle(ts);

while (tick_nohz_reprogram(ts, now)) {
now = ktime_get();
@@ -1065,17 +1073,10 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
{
struct tick_sched *ts =
container_of(timer, struct tick_sched, sched_timer);
- struct pt_regs *regs = get_irq_regs();
ktime_t now = ktime_get();

tick_sched_do_timer(now);
-
- /*
- * Do not call, when we are not in irq context and have
- * no valid regs pointer
- */
- if (regs)
- tick_sched_handle(ts, regs);
+ tick_sched_handle(ts);

hrtimer_forward(timer, now, tick_period);

--
1.7.12.rc2.18.g61b472e


\
 
 \ /
  Last update: 2014-04-18 09:21    [W:0.140 / U:4.968 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site