Re: tip: demise of tsk_cpus_allowed() and tsk_nr_cpus_allowed()

From: Peter Zijlstra
Date: Wed Feb 08 2017 - 07:35:27 EST


On Wed, Feb 08, 2017 at 11:20:19AM +0100, Thomas Gleixner wrote:
> On Mon, 6 Feb 2017, Ingo Molnar wrote:
> > * Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > >
> > > cpumasks are a pain, the above avoids allocating more of them.
>
> Indeed.
>
> > Yeah, so this could then be done by pointerifying ->cpus_allowed - more robust
> > than the wrappery,
>
> You mean:
>
> struct task_struct {
> cpumask_t cpus_allowed;
> cpumask_t *effective_cpus_allowed;
> };
>
> and make the scheduler use effective_cpus_allowed instead of cpus_allowed?
> Or what do you have in mind?

That scheme is weird for nr_cpus_allowed. Not to mention that the
pointer to the integer is larger than the integer itself.

I really prefer the current wrappers, they're trivial and consistent
with one another.