Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
scx: Pick an idle cpu when select runqueue with WF_EXEC
Browse files Browse the repository at this point in the history
If the caller of select_task_rq_scx() calls with WF_EXEC, it's a
valuable balancing opportunity to perform task migration. Although
runqueue can't dictate where the task is going to run, we can still take
advantage of this good opportunity by selecting an idle core, rather
than doing nothing.

Signed-off-by: I Hsin Cheng <[email protected]>
  • Loading branch information
vax-r committed Jun 13, 2024
1 parent 25c10e0 commit 445b763
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/sched/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -3107,8 +3107,10 @@ static int select_task_rq_scx(struct task_struct *p, int prev_cpu, int wake_flag
* which can decide to preempt self to force it through the regular
* scheduling path.
*/
if (unlikely(wake_flags & WF_EXEC))
return prev_cpu;
if (unlikely(wake_flags & WF_EXEC)) {
int idle_cpu = scx_pick_idle_cpu(p->cpus_ptr, SCX_PICK_IDLE_CORE);
return cpu;
}

if (SCX_HAS_OP(select_cpu)) {
s32 cpu;
Expand Down

0 comments on commit 445b763

Please sign in to comment.