diff options
| author | Tomas Glozar <tglozar@redhat.com> | 2026-08-14 15:55:07 +0200 |
|---|---|---|
| committer | Tomas Glozar <tglozar@redhat.com> | 2026-09-22 13:41:40 +0200 |
| commit | b3dc9905d7304cee7a114e85d9ad71004ea85d2f (patch) | |
| tree | b5e9160271ac24bc98ab6adc5eed0366e761ad89 /tools/perf/scripts/python/stackcollapse.py | |
| parent | c6bafe09bf536e01017b8bd77dcacf4f04069c48 (diff) | |
rtla: Replace get_nprocs_conf() with sysfs possible cpus
rtla uses get_nprocs_conf(), a standard libc routine, to retrieve the
total number of CPUs for the purpose of processing per-CPU data.
In some configurations, libc might return a different value than what is
seen by the kernel. To cover for this situation, replace the call to
get_nprocs_conf() with a newly added helper, get_possible_cpus().
get_possible_cpus() reads /sys/devices/system/cpu/possible and parses
the CPU list, identically to what libbpf_num_possible_cpus() does.
Additionally, it checks that the possible cpu list is zero-based and has
no holes by computing both the cpu count and the maximum cpu number.
Systems where /sys/.../cpu/possible is unreadable, is not zero-based,
or has holes, now report an error instead of crashing later due to unmet
assumptions.
Note that parse_cpu_set() cannot be used to parse
/sys/devices/system/cpu/possible, because it only supports CPU count of
1024 and lower. Higher CPU counts are not fully supported by rtla;
nr_cpus > 1024 is, though, so it has to be covered by the new
implementation in order to avoid a regression.
A new function, cpu_list_iterate(), is added to utils.c to contain the
cpu list parsing logic, which is now shared between the new function
get_possible_cpus() and the pre-existing parse_cpu_set().
Assisted-by: Claude:claude-opus-4-6
Link: https://lore.kernel.org/r/20260814135511.2207190-2-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
