sched/fair: Simplify hrtick_update()

hrtick_update() was needed when the slice depended on nr_running, all that
code is gone. All that remains is starting the hrtick when nr_running
becomes more than 1.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260224163428.866374835@kernel.org
This commit is contained in:
Peter Zijlstra (Intel) 2026-02-24 17:35:22 +01:00 committed by Peter Zijlstra
parent 558c18d3fb
commit 9701537664
2 changed files with 8 additions and 8 deletions

View File

@ -6769,9 +6769,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
}
/*
* called from enqueue/dequeue and updates the hrtick when the
* current task is from our class and nr_running is low enough
* to matter.
* Called on enqueue to start the hrtick when h_nr_queued becomes more than 1.
*/
static void hrtick_update(struct rq *rq)
{
@ -6780,6 +6778,9 @@ static void hrtick_update(struct rq *rq)
if (!hrtick_enabled_fair(rq) || donor->sched_class != &fair_sched_class)
return;
if (hrtick_active(rq))
return;
hrtick_start_fair(rq, donor);
}
#else /* !CONFIG_SCHED_HRTICK: */
@ -7102,9 +7103,6 @@ static int dequeue_entities(struct rq *rq, struct sched_entity *se, int flags)
WARN_ON_ONCE(!task_sleep);
WARN_ON_ONCE(p->on_rq != 1);
/* Fix-up what dequeue_task_fair() skipped */
hrtick_update(rq);
/*
* Fix-up what block_task() skipped.
*
@ -7138,8 +7136,6 @@ static bool dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
/*
* Must not reference @p after dequeue_entities(DEQUEUE_DELAYED).
*/
hrtick_update(rq);
return true;
}

View File

@ -3041,6 +3041,10 @@ static inline int hrtick_enabled_dl(struct rq *rq)
}
extern void hrtick_start(struct rq *rq, u64 delay);
static inline bool hrtick_active(struct rq *rq)
{
return hrtimer_active(&rq->hrtick_timer);
}
#else /* !CONFIG_SCHED_HRTICK: */