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: Refactor do_enqueue_task() local and global DSQ paths

The local and global DSQ enqueue paths in do_enqueue_task() share the same
slice refill logic. Factor out the common code into a shared enqueue label.
This makes adding new enqueue cases easier. No functional changes.

Reviewed-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

Tejun Heo 3546119f bfd3749d

+12 -9
+12 -9
kernel/sched/ext.c
··· 1279 1279 { 1280 1280 struct scx_sched *sch = scx_root; 1281 1281 struct task_struct **ddsp_taskp; 1282 + struct scx_dispatch_q *dsq; 1282 1283 unsigned long qseq; 1283 1284 1284 1285 WARN_ON_ONCE(!(p->scx.flags & SCX_TASK_QUEUED)); ··· 1347 1346 direct: 1348 1347 direct_dispatch(sch, p, enq_flags); 1349 1348 return; 1350 - 1349 + local_norefill: 1350 + dispatch_enqueue(sch, &rq->scx.local_dsq, p, enq_flags); 1351 + return; 1351 1352 local: 1353 + dsq = &rq->scx.local_dsq; 1354 + goto enqueue; 1355 + global: 1356 + dsq = find_global_dsq(sch, p); 1357 + goto enqueue; 1358 + 1359 + enqueue: 1352 1360 /* 1353 1361 * For task-ordering, slice refill must be treated as implying the end 1354 1362 * of the current slice. Otherwise, the longer @p stays on the CPU, the ··· 1365 1355 */ 1366 1356 touch_core_sched(rq, p); 1367 1357 refill_task_slice_dfl(sch, p); 1368 - local_norefill: 1369 - dispatch_enqueue(sch, &rq->scx.local_dsq, p, enq_flags); 1370 - return; 1371 - 1372 - global: 1373 - touch_core_sched(rq, p); /* see the comment in local: */ 1374 - refill_task_slice_dfl(sch, p); 1375 - dispatch_enqueue(sch, find_global_dsq(sch, p), p, enq_flags); 1358 + dispatch_enqueue(sch, dsq, p, enq_flags); 1376 1359 } 1377 1360 1378 1361 static bool task_runnable(const struct task_struct *p)