Skip to content

Retain CPU affinity when rescheduling#261

Merged
hexagonal-sun merged 1 commit intohexagonal-sun:masterfrom
arihant2math:retain-cpu-affin
Mar 18, 2026
Merged

Retain CPU affinity when rescheduling#261
hexagonal-sun merged 1 commit intohexagonal-sun:masterfrom
arihant2math:retain-cpu-affin

Conversation

@arihant2math
Copy link
Collaborator

Prevent cache invalidation. Task stealing should be easy to implement once an algorithm is in place.

Also the weird static logic has been replaced with a shared per cpu struct for simplicity (also because in the future it'd be good to prefer CPUs that share the same L3 cache/numa node/etc.).

CpuId::from_value((least_tasked_cpu_info & 0xffff) as usize)
let r = 0..ArchImpl::cpu_count();
r.min_by(|&x, &y| {
// TODO: Find a way to calculate already assigned affinities and account for that
Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, this is complicated since runqueues no longer own the tasks that they are waiting on . I suspect we'll end up using some kind of atomic count.

@arihant2math arihant2math force-pushed the retain-cpu-affin branch 2 times, most recently from 6fc8ce1 to 647a79e Compare March 16, 2026 17:32
Copy link
Owner

@hexagonal-sun hexagonal-sun left a comment

Choose a reason for hiding this comment

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

LGTM

@hexagonal-sun hexagonal-sun merged commit cc099bf into hexagonal-sun:master Mar 18, 2026
4 checks passed
@arihant2math arihant2math deleted the retain-cpu-affin branch March 18, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants