Skip to main content

Module sysfs

Module sysfs 

Source
Expand description

Topology discovery from Linux sysfs and procfs.

§Why sysfs and not CPUID

CPUID describes the silicon; sysfs describes the machine as the kernel has configured it. Only the kernel knows which CPUs are offline, how a cpuset or container has restricted us, what cpufreq policy is in force, and how caches are actually shared after firmware fusing. CoreScout therefore treats sysfs as authoritative and uses CPUID (see crate::platform::cpuid) only to fill gaps such as the brand string.

§Root injection

Sysfs holds the filesystem roots rather than hardcoding /sys and /proc. That is not an abstraction for its own sake: it lets the parser be exercised against captured sysfs trees in unit and integration tests, on any host OS, including machines with topologies nobody on the project owns.

This module is compiled on every platform precisely so those tests can run everywhere; only the syscall layer next door is Linux-only.

Structs§

Sysfs
Reader for a (possibly simulated) /sys + /proc pair.