diff mbox series

sched/core: Remove useless hrtimer_active check

Message ID 1529416963-20271-1-git-send-email-daniel.lezcano@linaro.org
State New
Headers show
Series sched/core: Remove useless hrtimer_active check | expand

Commit Message

Daniel Lezcano June 19, 2018, 2:02 p.m. UTC
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(-)

-- 
2.7.4

Comments

Daniel Lezcano July 10, 2018, 4:08 p.m. UTC | #1
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
diff mbox series

Patch

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);
 }
 
 /*