Skip to contentSkip to conversation

sched/fair: avoid redundant hrtimer check

PATCH Superseded Huichun Feng 2 participants 4 messages Jun 6, 2022 – Jun 18, 2022 Scheduler

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/fair: avoid redundant hrtimer check

The check is required iff HRTICK is enabled and DOUBLE_TICK is disabled, avoid the redundant check by adding corresponding sched_feat() .

---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
index 77b2048a9..80cc1a924 100644
@@ -4668,7 +4668,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
 	/*
 	 * don't let the period tick interfere with the hrtick preemption
 	 */
-	if (!sched_feat(DOUBLE_TICK) &&
+	if (sched_feat(HRTICK) && !sched_feat(DOUBLE_TICK) &&
 			hrtimer_active(&rq_of(cfs_rq)->hrtick_timer))
 		return;
 #endif
Signature · 1 line
2.36.1
maintainer
#1 lore raw
Quoted 2 lines · Huichun Feng

The check is required iff HRTICK is enabled and DOUBLE_TICK is disabled, avoid the redundant check by adding corresponding sched_feat() .

How about: 'don't do that then'?

#2 lore raw

Peter Zijlstra <[email protected]> 於 2022年6月9日 週四 下午8:29寫道:

Quoted 6 lines · Huichun Feng
Quoted 2 lines

The check is required iff HRTICK is enabled and DOUBLE_TICK is disabled, avoid the redundant check by adding corresponding sched_feat() .

How about: 'don't do that then'?

Looks good!

Should I send a v2 for this? Or could you help amend it directly?

Thank you!
Huichun

#3 lore raw
In reply to Peter Zijlstra

The check is required iff HRTICK is enabled and DOUBLE_TICK is disabled, don't do that then.

---

Changes since v1:
- Refine commit message

 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
index 77b2048a9..80cc1a924 100644
@@ -4668,7 +4668,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
        /*
         * don't let the period tick interfere with the hrtick preemption
         */
-       if (!sched_feat(DOUBLE_TICK) &&
+       if (sched_feat(HRTICK) && !sched_feat(DOUBLE_TICK) &&
                        hrtimer_active(&rq_of(cfs_rq)->hrtick_timer))
                return;
 #endif
Signature · 1 line
2.36.1