Re: [PATCH v3 1/2] sched/numa: Drive NUMA task tick from execution context
From: Chen, Yu C
Date: Tue Sep 08 2026 - 06:28:32 EST
On 9/8/2026 4:35 PM, Peter Zijlstra wrote:
What about something like so?
Thanks Peter for taking a look at this. I think this version achieves better decoupling
since the logic is added per scheduling class, rather than inserting random hooks into
the core scheduler.
-static void task_tick_scx(struct rq *rq, struct task_struct *curr, int queued)
+static void task_tick_scx(struct rq *rq, int queued)
{
+ struct task_struct *curr = rq->donor;
struct task_struct *donor = rq->donor
struct scx_sched *sch = scx_task_sched(curr);
+ if (donor->sched_class != &ext_sched_class)
+ return;
+
update_curr_scx(rq);
/*
[ ... ]
-static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
+static void task_tick_fair(struct rq *rq, int queued)
{
- struct sched_entity *se = &curr->se;
+ struct task_struct *curr = rq->curr, *donor = rq->donor;
- if (se->on_rq) {
- unsigned long weight = NICE_0_LOAD;
- struct cfs_rq *cfs_rq;
+ if (donor->sched_class == &fair_sched_class) {
+ struct sched_entity *se = &donor->se;
- for_each_sched_entity(se) {
- cfs_rq = cfs_rq_of(se);
- entity_tick(cfs_rq, se, queued);
+ if (se->on_rq) {
+ unsigned long weight = NICE_0_LOAD;
+ struct cfs_rq *cfs_rq;
- weight = __calc_prop_weight(cfs_rq, se, weight);
+ for_each_sched_entity(se) {
+ cfs_rq = cfs_rq_of(se);
+ entity_tick(cfs_rq, se, queued);
+
+ weight = __calc_prop_weight(cfs_rq, se, weight);
+ }
+
+ se = &donor->se;
+ reweight_eevdf(cfs_rq, se, weight, se->on_rq);
}
- se = &curr->se;
- reweight_eevdf(cfs_rq, se, weight, se->on_rq);
+ if (queued)
+ return;
+
+ update_misfit_status(donor, rq);
+ check_update_overutilized_status(task_rq(donor));
+
+ task_tick_core(rq, donor);
}
- if (queued)
- return;
The queued check might still be needed: if donor is not a fair task, we still
want to skip the numa balancing/sched_cache for hrtick event?
thanks,
Chenyu