Skip to content

Commit

Permalink
layered: actually get slice_ns and max_exec_ns from CO:RE
Browse files Browse the repository at this point in the history
Layered previously hardcoded the defaults for slice_ns and max_exec_us. This
was changed in a recent PR to get these from CO:RE in the running kernel. This
change doesn't work because the old values are still set a few lines below.

Remove the old method of setting these values allowing CO:RE to win.

Test plan:
- CI
  • Loading branch information
JakeHillion committed Dec 3, 2024
1 parent 596268e commit 3c5ca43
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions scheds/rust/scx_layered/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,6 @@ impl<'a> Scheduler<'a> {
skel_builder.obj_builder.debug(opts.verbose > 1);
init_libbpf_logging(None);
let mut skel = scx_ops_open!(skel_builder, open_object, layered)?;
skel.maps.rodata_data.slice_ns = scx_enums.SCX_SLICE_DFL;
skel.maps.rodata_data.max_exec_ns = 20 * scx_enums.SCX_SLICE_DFL;

// Initialize skel according to @opts.
skel.struct_ops.layered_mut().exit_dump_len = opts.exit_dump_len;
Expand All @@ -1562,12 +1560,8 @@ impl<'a> Scheduler<'a> {
// Running scx_layered inside a PID namespace would break the
// following.
skel.maps.rodata_data.layered_tgid = std::process::id() as i32;
skel.maps.rodata_data.slice_ns = opts.slice_us * 1000;
skel.maps.rodata_data.max_exec_ns = if opts.max_exec_us > 0 {
opts.max_exec_us * 1000
} else {
opts.slice_us * 1000 * 20
};
skel.maps.rodata_data.slice_ns = scx_enums.SCX_SLICE_DFL;
skel.maps.rodata_data.max_exec_ns = 20 * scx_enums.SCX_SLICE_DFL;
skel.maps.rodata_data.nr_possible_cpus = *NR_CPUS_POSSIBLE as u32;
skel.maps.rodata_data.smt_enabled = cpu_pool.nr_cpus > cpu_pool.nr_cores;
skel.maps.rodata_data.has_little_cores = topo.has_little_cores();
Expand Down

0 comments on commit 3c5ca43

Please sign in to comment.