mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-26 11:30:22 +00:00
scx_rusty: fix stats map initialization
The stats map in scx_rusty is a BPF_MAP_TYPE_PERCPU_ARRAY, with its size
determined by num_possible_cpus(). Initializing it with nr_cpu_ids() can
result in errors such as:
Error: Failed to zero stat
Caused by:
number of values 6 != number of cpus 8
Fix by using num_possible_cpus() to initialize it.
Fixes: 263e02f6
("rusty: Use nr_cpu_ids instead of nr_cpus_possible")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
parent
14a33b6275
commit
d76551bbd3
@ -485,7 +485,7 @@ impl<'a> Scheduler<'a> {
|
||||
let stats_map = maps.stats();
|
||||
let mut stats: Vec<u64> = Vec::new();
|
||||
let zero_vec =
|
||||
vec![vec![0u8; stats_map.value_size() as usize]; self.top.nr_cpu_ids()];
|
||||
vec![vec![0u8; stats_map.value_size() as usize]; self.top.nr_cpus_possible()];
|
||||
|
||||
for stat in 0..bpf_intf::stat_idx_RUSTY_NR_STATS {
|
||||
let cpu_stat_vec = stats_map
|
||||
|
Loading…
Reference in New Issue
Block a user