diff options
| author | Tejun Heo <tj@kernel.org> | 2026-10-17 15:59:47 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-10-19 10:59:07 -1000 |
| commit | c71ecdf0d89d6871bd57560fcf40997b3e6d4d7e (patch) | |
| tree | 9b825e6640995e329a0de00dd1c7377f5f818a05 /kernel | |
| parent | 1f5dde349ac2fca1f119ae8de3f0d2f1c2a8d338 (diff) | |
| download | linux-c71ecdf0d89d6871bd57560fcf40997b3e6d4d7e.tar.gz linux-c71ecdf0d89d6871bd57560fcf40997b3e6d4d7e.zip | |
sched_ext: Factor out cid_pshard()
Factor the cid to pshard lookup out of the ecaps sync paths into
cid_pshard() so that new sync paths can share it. No functional change.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/ext/sub.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/sched/ext/sub.c b/kernel/sched/ext/sub.c index 1345e4174775..7edad2ddaa54 100644 --- a/kernel/sched/ext/sub.c +++ b/kernel/sched/ext/sub.c @@ -1063,6 +1063,12 @@ static void discard_queued_syncs(struct rq *rq) init_llist_node(pos); } +/* the pshard holding @sch's caps on @cid */ +static struct scx_pshard *cid_pshard(struct scx_sched *sch, s32 cid) +{ + return sch->pshard[rcu_dereference_all(scx_cid_to_shard)[cid]]; +} + /** * __scx_process_sync_ecaps - Sync this cpu's ecaps to pshard->caps[] * @rq: the cid's cpu rq @@ -1079,7 +1085,7 @@ static void discard_queued_syncs(struct rq *rq) void __scx_process_sync_ecaps(struct rq *rq, struct task_struct *prev) { s32 cpu = cpu_of(rq); - s32 cid, shard; + s32 cid; struct llist_node *batch, *pos, *tmp; u64 lost_all = 0; @@ -1101,13 +1107,12 @@ void __scx_process_sync_ecaps(struct rq *rq, struct task_struct *prev) /* @cid is valid here: the cpu is active with queued syncs */ cid = __scx_cpu_to_cid(cpu); - shard = rcu_dereference_all(scx_cid_to_shard)[cid]; batch = llist_del_all(&rq->scx.ecaps_to_sync); llist_for_each_safe(pos, tmp, batch) { struct scx_sched_pcpu *pcpu = container_of(pos, struct scx_sched_pcpu, ecaps_to_sync_node); - struct scx_pshard *ps = pcpu->sch->pshard[shard]; + struct scx_pshard *ps = cid_pshard(pcpu->sch, cid); u64 old, ecaps, lost, gained; init_llist_node(pos); @@ -1229,7 +1234,7 @@ void scx_unbypass_replay_ecaps(struct rq *rq, struct scx_sched *sch) void scx_online_ecaps(struct rq *rq) { struct scx_sched *root, *pos; - s32 cid, shard; + s32 cid; /* * Only a live hierarchy can have ecaps to reseed. This also keeps the @@ -1244,7 +1249,6 @@ void scx_online_ecaps(struct rq *rq) root = scx_root_protected(); cid = __scx_cpu_to_cid(cpu_of(rq)); - shard = rcu_dereference_all(scx_cid_to_shard)[cid]; scx_for_each_descendant_pre(pos, root) { struct scx_pshard *ps; @@ -1253,7 +1257,7 @@ void scx_online_ecaps(struct rq *rq) if (!pos->level) continue; - ps = pos->pshard[shard]; + ps = cid_pshard(pos, cid); guard(raw_spinlock)(&ps->lock); queue_sync_ecaps(pos, cid); } |
