[PATCH v8 00/18] Simplify running with high-numbered CPUs
Morten Brørup
mb at smartsharesystems.com
Mon Oct 6 09:42:20 CEST 2025
Bruce,
cpu_set_t is a fixed size array, with the size CPU_SETSIZE.
This is part of libc.
However, the kernel may be built with support for a different number of CPUs.
This means that e.g. sched_getaffinity() will fail with EINVAL if cpusetsize is smaller than the number of CPUs the kernel was built for.
For more information, refer to the description about "Dynamically sized CPU sets" here:
https://linux.die.net/man/3/cpu_alloc_size
With this series, consider ensuring that all DPDK functions taking a cpu set parameter also take a cpu set size parameter, to align with kernel APIs.
E.g.:
int sched_getaffinity(pid_t pid,
size_t cpusetsize, cpu_set_t *mask), and
void CPU_ZERO_S(size_t setsize, cpu_set_t *set),
instead of:
void CPU_ZERO(cpu_set_t *set).
<feature creep>
Consider not using fixed size cpu sets (and CPU_SETSIZE) at all, but dynamically allocated cpu sets.
</feature creep>
<joke>
Consider not using fixed size lcore arrays (and RTE_MAX_LCORE) at all, but dynamically allocated lcore arrays.
</joke>
Venlig hilsen / Kind regards,
-Morten Brørup
More information about the dev
mailing list