You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the CpuSet struct consists of a single cpu_set_t (or cpuset_t on *BSD), and sched_*etaffinity syscalls are called with constant cpusetsize parameter, always being mem::size_of::<CpuSet>() (=64 on all targets, at least those I care about) regardless of what the value of sysconf(_SC_NPROCESSORS_CONF) would be.
What I would like to see is some future-proof design, that would support for a runtime-sized allocation of cpu_set_t slice, similarly to what C macros such as CPU_ALLOC() facilitate.
For example, I can see this being abstracted behind CpuSet being an enum internally, that either has some default sized stack value, or dynamically sized slice on heap, and the affinity calls picking the logic depending on the variant. Or there could be two types like CpuSet and CpuSetDyn implementing the same (unsafe?) trait, providing cpusetsize and a pointer to the first cpuset_t, making the affinity fns generic over this trait.
The text was updated successfully, but these errors were encountered:
Currently the
CpuSet
struct consists of a singlecpu_set_t
(orcpuset_t
on *BSD), andsched_*etaffinity
syscalls are called with constantcpusetsize
parameter, always beingmem::size_of::<CpuSet>()
(=64 on all targets, at least those I care about) regardless of what the value ofsysconf(_SC_NPROCESSORS_CONF)
would be.What I would like to see is some future-proof design, that would support for a runtime-sized allocation of
cpu_set_t
slice, similarly to what C macros such asCPU_ALLOC()
facilitate.For example, I can see this being abstracted behind
CpuSet
being an enum internally, that either has some default sized stack value, or dynamically sized slice on heap, and the affinity calls picking the logic depending on the variant. Or there could be two types likeCpuSet
andCpuSetDyn
implementing the same (unsafe?) trait, providingcpusetsize
and a pointer to the firstcpuset_t
, making the affinityfn
s generic over this trait.The text was updated successfully, but these errors were encountered: