Skip to content

Commit 60e339b

Browse files
Byte-Labhtejun
authored andcommitted
sched_ext: Remove unnecessary cpu_relax()
As described in commit b07996c ("sched_ext: Don't hold scx_tasks_lock for too long"), we're doing a cond_resched() every 32 calls to scx_task_iter_next() to avoid RCU and other stalls. That commit also added a cpu_relax() to the codepath where we drop and reacquire the lock, but as Waiman described in [0], cpu_relax() should only be necessary in busy loops to avoid pounding on a cacheline (or to allow a hypertwin to more fully utilize a core). Let's remove the unnecessary cpu_relax(). [0]: https://lore.kernel.org/all/[email protected]/ Cc: Waiman Long <[email protected]> Signed-off-by: David Vernet <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent b07996c commit 60e339b

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

kernel/sched/ext.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,6 @@ static struct task_struct *scx_task_iter_next(struct scx_task_iter *iter)
13741374

13751375
if (!(++iter->cnt % SCX_OPS_TASK_ITER_BATCH)) {
13761376
scx_task_iter_unlock(iter);
1377-
cpu_relax();
13781377
cond_resched();
13791378
scx_task_iter_relock(iter);
13801379
}

0 commit comments

Comments
 (0)