Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Factor out local_dsq_post_enq() from dispatch_enqueue()

Factor out local_dsq_post_enq() which performs post-enqueue handling for
local DSQs - triggering resched_curr() if SCX_ENQ_PREEMPT is specified or if
the current CPU is idle. No functional change.

This will be used by the next patch to fix move_local_task_to_local_dsq().

Cc: stable@vger.kernel.org # v6.12+
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

Tejun Heo 530b6637 9f769637

+19 -15
+19 -15
kernel/sched/ext.c
··· 982 982 __scx_add_event(sch, SCX_EV_REFILL_SLICE_DFL, 1); 983 983 } 984 984 985 + static void local_dsq_post_enq(struct scx_dispatch_q *dsq, struct task_struct *p, 986 + u64 enq_flags) 987 + { 988 + struct rq *rq = container_of(dsq, struct rq, scx.local_dsq); 989 + bool preempt = false; 990 + 991 + if ((enq_flags & SCX_ENQ_PREEMPT) && p != rq->curr && 992 + rq->curr->sched_class == &ext_sched_class) { 993 + rq->curr->scx.slice = 0; 994 + preempt = true; 995 + } 996 + 997 + if (preempt || sched_class_above(&ext_sched_class, rq->curr->sched_class)) 998 + resched_curr(rq); 999 + } 1000 + 985 1001 static void dispatch_enqueue(struct scx_sched *sch, struct scx_dispatch_q *dsq, 986 1002 struct task_struct *p, u64 enq_flags) 987 1003 { ··· 1109 1093 if (enq_flags & SCX_ENQ_CLEAR_OPSS) 1110 1094 atomic_long_set_release(&p->scx.ops_state, SCX_OPSS_NONE); 1111 1095 1112 - if (is_local) { 1113 - struct rq *rq = container_of(dsq, struct rq, scx.local_dsq); 1114 - bool preempt = false; 1115 - 1116 - if ((enq_flags & SCX_ENQ_PREEMPT) && p != rq->curr && 1117 - rq->curr->sched_class == &ext_sched_class) { 1118 - rq->curr->scx.slice = 0; 1119 - preempt = true; 1120 - } 1121 - 1122 - if (preempt || sched_class_above(&ext_sched_class, 1123 - rq->curr->sched_class)) 1124 - resched_curr(rq); 1125 - } else { 1096 + if (is_local) 1097 + local_dsq_post_enq(dsq, p, enq_flags); 1098 + else 1126 1099 raw_spin_unlock(&dsq->lock); 1127 - } 1128 1100 } 1129 1101 1130 1102 static void task_unlink_from_dsq(struct task_struct *p,