diff mbox

[29/38] tick-sched: remove wrapper around __tick_nohz_task_switch()

Message ID CAKohponji62SKmbfnELX0pwk3Yy14gDat2sJ-OJctmybqQSCGA@mail.gmail.com
State New
Headers show

Commit Message

Viresh Kumar April 16, 2014, 5:43 a.m. UTC
On 15 April 2014 18:14, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> Sure but check out the static_key_false() in the implementation of tick_nohz_full_enabled().
> That's where the magic hides.

> No problem, the jump label/static key code is quite tricky. And its use
> can be easily missed, as in here.
>
> Also its unfamous API naming (static_key_true/static_key_true) that is
> anything but intuitive.

That was tricky enough to be missed on first look :)

Okay here is the answer to what you asked earlier:

>> In this case probably we can move !can_stop_full_tick() as well to the wrapper ?
>
> Do you mean moving all the code of __tick_nohz_task_switch() to tick_nohz_task_switch()?
> I much prefer we don't do that. This is going to make can_stop_full_tick() a publicly
> visible nohz internal. And it may uglify tick.h as well.

I probably asked the wrong question, I meant tick_nohz_tick_stopped()
instead of !can_stop_full_tick().

Or, can we make the code more efficient by avoiding a branch by doing this:

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/include/linux/tick.h b/include/linux/tick.h
index 1065a51..12632cc 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -220,7 +220,7 @@  static inline void tick_nohz_full_check(void)

 static inline void tick_nohz_task_switch(void)
 {
-       if (tick_nohz_full_enabled())
+       if (tick_nohz_full_enabled() && tick_nohz_tick_stopped())
                __tick_nohz_task_switch();
 }

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 45037c4..904e09b 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -273,7 +273,7 @@  void __tick_nohz_task_switch(void)

        local_irq_save(flags);

-       if (tick_nohz_tick_stopped() && !can_stop_full_tick())
+       if (!can_stop_full_tick())
                tick_nohz_full_kick();

        local_irq_restore(flags);