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 35/38] tick-broadcast: do checks before taking locks in tick_do_broadcast_on_off()
Date
Some of the checks which may force tick_do_broadcast_on_off() to return early
can be done before taking locks. This would make these codepaths faster.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
kernel/time/tick-broadcast.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 1597d03..3b07569 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -329,27 +329,22 @@ unlock:
*/
static void tick_do_broadcast_on_off(unsigned long *reason)
{
- struct clock_event_device *bc, *dev;
- struct tick_device *td;
+ struct tick_device *td = tick_get_cpu_device();
+ struct clock_event_device *bc, *dev = td->evtdev;
+ int cpu = smp_processor_id(), bc_stopped;
unsigned long flags;
- int cpu, bc_stopped;
-
- raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
-
- cpu = smp_processor_id();
- td = tick_get_device(cpu);
- dev = td->evtdev;
- bc = tick_broadcast_device.evtdev;

/*
* Is the device not affected by the powerstate ?
*/
if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP))
- goto out;
+ return;

if (!tick_device_is_functional(dev))
- goto out;
+ return;

+ raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
+ bc = tick_broadcast_device.evtdev;
bc_stopped = cpumask_empty(tick_broadcast_mask);

switch (*reason) {
@@ -385,7 +380,6 @@ static void tick_do_broadcast_on_off(unsigned long *reason)
else
tick_broadcast_setup_oneshot(bc);
}
-out:
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
}

--
1.7.12.rc2.18.g61b472e


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