Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scx_layered: Add Big/Little core growth algos #667

Merged
merged 2 commits into from
Sep 22, 2024

Conversation

hodgesds
Copy link
Contributor

@hodgesds hodgesds commented Sep 20, 2024

Add layer growth algos for big/little core topologies that prefer one core type. Discussed this with @JakeHillion at LPC as another way to grow layers.

Add extra ordering macros for Core/CPU structs for ease of use with
Rust standard library features. This issue was hit when trying to sort
cores based on the CoreType. See this similar issue for details:
rust-lang/rust#113550

Signed-off-by: Daniel Hodges <[email protected]>
@hodgesds
Copy link
Contributor Author

I will test this when I get back from LPC on some actual hardware to make sure the ordering is correct.

Add core growth algos for Big/Little core support. The algos allow
layers to grow layers by preferring either big or little cores first.

Signed-off-by: Daniel Hodges <[email protected]>
@@ -99,13 +99,13 @@ lazy_static::lazy_static! {
pub static ref NR_CPUS_POSSIBLE: usize = libbpf_rs::num_possible_cpus().unwrap();
}

#[derive(Debug, Clone, Eq, Hash, PartialEq)]
#[derive(Debug, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added the extra sorting macros because I ran into this when trying to sort by CoreType.

@hodgesds
Copy link
Contributor Author

Sorting works properly:

06:58:41 [DEBUG] layer: daemon algo: Random core order: [5, 4, 6, 8, 1, 7, 0, 9, 2, 3]
06:58:41 [DEBUG] layer: immediate algo: BigLittle core order: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
06:58:41 [DEBUG] layer: normal algo: LittleBig core order: [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

The pcores on the tested machine (Intel i3-1220P) are ordered correctly:

$ lstopo
Machine (47GB total)
  Package L#0
    NUMANode L#0 (P#0 47GB)
    L3 L#0 (12MB)
      L2 L#0 (1280KB) + L1d L#0 (48KB) + L1i L#0 (32KB) + Core L#0
        PU L#0 (P#0)
        PU L#1 (P#1)
      L2 L#1 (1280KB) + L1d L#1 (48KB) + L1i L#1 (32KB) + Core L#1
        PU L#2 (P#2)
        PU L#3 (P#3)
      L2 L#2 (2048KB)
        L1d L#2 (32KB) + L1i L#2 (64KB) + Core L#2 + PU L#4 (P#4)
        L1d L#3 (32KB) + L1i L#3 (64KB) + Core L#3 + PU L#5 (P#5)
        L1d L#4 (32KB) + L1i L#4 (64KB) + Core L#4 + PU L#6 (P#6)
        L1d L#5 (32KB) + L1i L#5 (64KB) + Core L#5 + PU L#7 (P#7)
      L2 L#3 (2048KB)
        L1d L#6 (32KB) + L1i L#6 (64KB) + Core L#6 + PU L#8 (P#8)
        L1d L#7 (32KB) + L1i L#7 (64KB) + Core L#7 + PU L#9 (P#9)
        L1d L#8 (32KB) + L1i L#8 (64KB) + Core L#8 + PU L#10 (P#10)
        L1d L#9 (32KB) + L1i L#9 (64KB) + Core L#9 + PU L#11 (P#11)

@hodgesds hodgesds merged commit 326f3b7 into sched-ext:main Sep 22, 2024
1 of 2 checks passed
@hodgesds hodgesds deleted the layered-pcore-grow branch September 22, 2024 20:59
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