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

scx: Update conditions for WAKE_SYNC migration #167

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions kernel/sched/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -2084,12 +2084,18 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu,
}

/*
* If WAKE_SYNC and the machine isn't fully saturated, wake up @p to the
* local DSQ of the waker.
* If WAKE_SYNC, the waker's local DSQ is empty, and the system is
* under utilized, wake up @p to the local DSQ of the waker. Checking
* only for an empty local DSQ is insufficient as it could give the
* wakee an unfair advantage when the system is oversaturated.
* Checking only for the presence of idle CPUs is also insufficient as
* the local DSQ of the waker could have tasks piled up on it even if
* there is an idle core elsewhere on the system.
*/
cpu = smp_processor_id();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, also, what does this relocation do?

Copy link
Collaborator Author

@Byte-Lab Byte-Lab Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it for the cpu_rq(cpu) call. Maybe it's a bit better to just use this_rq()?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I mean, moving it out is completely fine. I just missed where it's used.

if ((wake_flags & SCX_WAKE_SYNC) && p->nr_cpus_allowed > 1 &&
!cpumask_empty(idle_masks.cpu) && !(current->flags & PF_EXITING)) {
cpu = smp_processor_id();
!cpumask_empty(idle_masks.cpu) && !(current->flags & PF_EXITING) &&
cpu_rq(cpu)->scx.local_dsq.nr == 0) {
if (cpumask_test_cpu(cpu, p->cpus_ptr))
goto cpu_found;
}
Expand Down