[PATCH v8 00/18] Simplify running with high-numbered CPUs
Bruce Richardson
bruce.richardson at intel.com
Mon Oct 6 10:41:45 CEST 2025
On Mon, Oct 06, 2025 at 09:42:20AM +0200, Morten Brørup wrote:
> 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).
>
Ok, that seems a feasible change.
> <feature creep>
> Consider not using fixed size cpu sets (and CPU_SETSIZE) at all, but dynamically allocated cpu sets.
> </feature creep>
>
Will have to see what that involves. If it's fairly easy, I'll give it a
go, but we are rather late in this release cycle, so if it's taking too
long I'll have to give this bit a miss.
/Bruce
More information about the dev
mailing list