linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] timer: avoid unnecessary waking up of nohz CPU
@ 2015-04-28  2:21 Joonwoo Park
  2015-04-28 21:59 ` Stephen Boyd
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Joonwoo Park @ 2015-04-28  2:21 UTC (permalink / raw)
  To: tglx; +Cc: sboyd, skannan, linux-kernel, Joonwoo Park, John Stultz

At present, internal_add_timer() examines flags with 'base' which doesn't
contain flags.  Examine with 'timer->base' to avoid unnecessary waking up
of nohz CPU when timer base has TIMER_DEFERRABLE.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: John Stultz <john.stultz@linaro.org>
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
---
 kernel/time/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 2ece3aa..e5d5733c 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -434,7 +434,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
 	 * require special care against races with idle_cpu(), lets deal
 	 * with that later.
 	 */
-	if (!tbase_get_deferrable(base) || tick_nohz_full_cpu(base->cpu))
+	if (!tbase_get_deferrable(timer->base) || tick_nohz_full_cpu(base->cpu))
 		wake_up_nohz_cpu(base->cpu);
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] timer: avoid unnecessary waking up of nohz CPU
  2015-04-28  2:21 [PATCH 1/2] timer: avoid unnecessary waking up of nohz CPU Joonwoo Park
@ 2015-04-28 21:59 ` Stephen Boyd
  2015-04-29  2:41 ` Viresh Kumar
  2015-05-05  8:42 ` [tip:timers/core] timer: Use timer->base for flag checks tip-bot for Joonwoo Park
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2015-04-28 21:59 UTC (permalink / raw)
  To: Joonwoo Park, tglx
  Cc: skannan, linux-kernel, John Stultz, Viresh Kumar,
	Frederic Weisbecker

On 04/27/15 19:21, Joonwoo Park wrote:
> At present, internal_add_timer() examines flags with 'base' which doesn't
> contain flags.  Examine with 'timer->base' to avoid unnecessary waking up
> of nohz CPU when timer base has TIMER_DEFERRABLE.
>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
> ---
>  kernel/time/timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index 2ece3aa..e5d5733c 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -434,7 +434,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
>  	 * require special care against races with idle_cpu(), lets deal
>  	 * with that later.
>  	 */
> -	if (!tbase_get_deferrable(base) || tick_nohz_full_cpu(base->cpu))
> +	if (!tbase_get_deferrable(timer->base) || tick_nohz_full_cpu(base->cpu))
>  		wake_up_nohz_cpu(base->cpu);
>  }
>  

This looks like a fix for commit 9f6d9baaa8ca (timer: Kick dynticks
targets on mod_timer*() calls, 2014-06-22) which changed the code to use
base instead of timer->base when it moved this condition from
add_timer_on() into internal_add_timer(). Is that right?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] timer: avoid unnecessary waking up of nohz CPU
  2015-04-28  2:21 [PATCH 1/2] timer: avoid unnecessary waking up of nohz CPU Joonwoo Park
  2015-04-28 21:59 ` Stephen Boyd
@ 2015-04-29  2:41 ` Viresh Kumar
  2015-05-05  8:42 ` [tip:timers/core] timer: Use timer->base for flag checks tip-bot for Joonwoo Park
  2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2015-04-29  2:41 UTC (permalink / raw)
  To: Joonwoo Park
  Cc: Thomas Gleixner, Stephen Boyd, Saravana Kannan,
	linux-kernel@vger.kernel.org, John Stultz

On Tue, Apr 28, 2015 at 7:51 AM, Joonwoo Park <joonwoop@codeaurora.org> wrote:
> At present, internal_add_timer() examines flags with 'base' which doesn't
> contain flags.  Examine with 'timer->base' to avoid unnecessary waking up
> of nohz CPU when timer base has TIMER_DEFERRABLE.
>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
> ---
>  kernel/time/timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index 2ece3aa..e5d5733c 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -434,7 +434,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
>          * require special care against races with idle_cpu(), lets deal
>          * with that later.
>          */
> -       if (!tbase_get_deferrable(base) || tick_nohz_full_cpu(base->cpu))
> +       if (!tbase_get_deferrable(timer->base) || tick_nohz_full_cpu(base->cpu))
>                 wake_up_nohz_cpu(base->cpu);
>  }

Oops !!

Fixes: 9f6d9baaa8ca ("timer: Kick dynticks targets on mod_timer*() calls")
Cc: 3.17+ <stable@vger.kernel.org> # 3.17+

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:timers/core] timer: Use timer->base for flag checks
  2015-04-28  2:21 [PATCH 1/2] timer: avoid unnecessary waking up of nohz CPU Joonwoo Park
  2015-04-28 21:59 ` Stephen Boyd
  2015-04-29  2:41 ` Viresh Kumar
@ 2015-05-05  8:42 ` tip-bot for Joonwoo Park
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Joonwoo Park @ 2015-05-05  8:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, john.stultz, tglx, joonwoop, hpa, mingo

Commit-ID:  781978e6e156101209f62b9ebc8783b70ef248de
Gitweb:     http://git.kernel.org/tip/781978e6e156101209f62b9ebc8783b70ef248de
Author:     Joonwoo Park <joonwoop@codeaurora.org>
AuthorDate: Mon, 27 Apr 2015 19:21:49 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 5 May 2015 10:40:43 +0200

timer: Use timer->base for flag checks

At present, internal_add_timer() examines flags with 'base' which doesn't
contain flags.  Examine with 'timer->base' to avoid unnecessary waking up
of nohz CPU when timer base has TIMER_DEFERRABLE set.

Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Cc: sboyd@codeaurora.org
Cc: skannan@codeaurora.org
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/1430187709-21087-1-git-send-email-joonwoop@codeaurora.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 03f926c..d4af7c5 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -436,7 +436,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
 	 * require special care against races with idle_cpu(), lets deal
 	 * with that later.
 	 */
-	if (!tbase_get_deferrable(base) || tick_nohz_full_cpu(base->cpu))
+	if (!tbase_get_deferrable(timer->base) || tick_nohz_full_cpu(base->cpu))
 		wake_up_nohz_cpu(base->cpu);
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-05  8:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-28  2:21 [PATCH 1/2] timer: avoid unnecessary waking up of nohz CPU Joonwoo Park
2015-04-28 21:59 ` Stephen Boyd
2015-04-29  2:41 ` Viresh Kumar
2015-05-05  8:42 ` [tip:timers/core] timer: Use timer->base for flag checks tip-bot for Joonwoo Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).