linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/core: Remove useless hrtimer_active check
@ 2018-06-19 14:02 Daniel Lezcano
  2018-07-10 16:08 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Lezcano @ 2018-06-19 14:02 UTC (permalink / raw)
  To: peterz; +Cc: linux-kernel, Ingo Molnar

The function tick_clear() checks if the timer is active and in this case
cancels the timer. However, hrtimer_cancel does the same check.

Perhaps, this test is made on purpose to skip some function calls for
efficiency reasons but if it is not the case we can safely remove it.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d155518..aa46aa6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -218,8 +218,7 @@ void update_rq_clock(struct rq *rq)
 
 static void hrtick_clear(struct rq *rq)
 {
-	if (hrtimer_active(&rq->hrtick_timer))
-		hrtimer_cancel(&rq->hrtick_timer);
+	hrtimer_cancel(&rq->hrtick_timer);
 }
 
 /*
-- 
2.7.4


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

* Re: [PATCH] sched/core: Remove useless hrtimer_active check
  2018-06-19 14:02 [PATCH] sched/core: Remove useless hrtimer_active check Daniel Lezcano
@ 2018-07-10 16:08 ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2018-07-10 16:08 UTC (permalink / raw)
  To: peterz; +Cc: linux-kernel, Ingo Molnar

On 19/06/2018 16:02, Daniel Lezcano wrote:
> The function tick_clear() checks if the timer is active and in this case
> cancels the timer. However, hrtimer_cancel does the same check.
> 
> Perhaps, this test is made on purpose to skip some function calls for
> efficiency reasons but if it is not the case we can safely remove it.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  kernel/sched/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index d155518..aa46aa6 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -218,8 +218,7 @@ void update_rq_clock(struct rq *rq)
>  
>  static void hrtick_clear(struct rq *rq)
>  {
> -	if (hrtimer_active(&rq->hrtick_timer))
> -		hrtimer_cancel(&rq->hrtick_timer);
> +	hrtimer_cancel(&rq->hrtick_timer);
>  }
>  
>  /*

May be not the patch of the century but just a gentle bump if it was
lost by more important patchset review.


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

end of thread, other threads:[~2018-07-10 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 14:02 [PATCH] sched/core: Remove useless hrtimer_active check Daniel Lezcano
2018-07-10 16:08 ` Daniel Lezcano

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).