[PATCH v5 3/4] sched/cache: Drive cache task tick from execution context
From: Hui Su
Date: Sun Sep 13 2026 - 02:49:34 EST
Proxy execution separates the scheduling context in rq->donor from the
execution context in rq->curr. Keep the fair task tick organized as one
donor-owned block followed by one execution-context block.
Task cache accounting is performed for rq->curr by account_mm_sched(), and
cache tick handling must operate on the same execution context. With proxy
execution, keeping task_tick_cache() on the donor can leave the executing
task's cache state and epoch stale.
Move task_tick_cache() into the execution-context section alongside the
NUMA tick. The final layout has one donor-owned block containing entity,
misfit, overutilized and core-scheduling work, followed by one
execution-context block containing NUMA and cache work. Preserve the normal
queued/hrtick gating while attributing each operation to the right context.
Fixes: df0d98475954 ("sched/cache: Introduce infrastructure for cache-aware load balancing")
Suggested-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
Signed-off-by: Hui Su <sh_def@xxxxxxx>
---
kernel/sched/fair.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 002456cf9f8d..ed08b287016a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -15082,7 +15082,6 @@ static void task_tick_fair(struct rq *rq, int queued)
}
if (!queued) {
- task_tick_cache(rq, donor);
update_misfit_status(donor, rq);
check_update_overutilized_status(task_rq(donor));
@@ -15094,10 +15093,12 @@ static void task_tick_fair(struct rq *rq, int queued)
return;
/* Update state owned by the execution context. */
- if (curr->sched_class == &fair_sched_class &&
- static_branch_unlikely(&sched_numa_balancing))
- task_tick_numa(rq, curr);
+ if (curr->sched_class == &fair_sched_class) {
+ if (static_branch_unlikely(&sched_numa_balancing))
+ task_tick_numa(rq, curr);
+ task_tick_cache(rq, curr);
+ }
}
/*
--
2.55.0