Re: [PATCH v4] sched/core: Use zero length to reset cpumasks in sched_setaffinity()

From: Peter Zijlstra
Date: Wed Oct 04 2023 - 09:52:55 EST


On Wed, Oct 04, 2023 at 02:34:15PM +0200, Florian Weimer wrote:
> * Peter Zijlstra:
>
> > Subject: sched: Add CPU_FILL()
> >
> > Add the CPU_FILL() macros to easily create an all-set cpumask.
> >
> > FreeBSD also provides this macro with this semantic.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
>
> My main concer is that obtaining the size of the mask, or at least an
> approximiation is not exactly easy. If there's an expectation that
> applications reset the mask more often than they do today (I don't have
> the full context here), then we'd some decent interface to get the
> approriate size.

Isn't sysconf(_SC_NPROCESSORS_CONF) the right number ?