Re: [PATCH 2/2] kvm: use cpumask_var_t for cpus_hardware_enabled

Rusty Russell
2008-12-08T06:05:52Z

On Monday 08 December 2008 02:25:50 Avi Kivity wrote:
> Rusty Russell wrote:
> > This changes cpus_hardware_enabled from a cpumask_t to a cpumask_var_t:
> > equivalent for CONFIG_CPUMASKS_OFFSTACK=n, otherwise dynamically allocated.
> >
> >
> > -static cpumask_t cpus_hardware_enabled;
> > +static cpumask_var_t cpus_hardware_enabled
>
> This isn't on stack, so it isn't buying us anything.

It's the CONFIG_NR_CPUS=4096 but nr_cpu_ids=4 case which we win using
dynamic allocation. Gotta love distribution kernels.

> Is the plan to drop cpumask_t?

Yes. And undefine 'struct cpumask' if CONFIG_CPUMASK_OFFSTACK. That
will stop assignment and on-stack declarations for all but the most
determined.

> If so, we're penalizing non-stack users
> by forcing them to go through another pointer (and cacheline).

Not quite. If !CONFIG_CPUMASK_OFFSTACK, cpumask_var_t == cpumask_t[1].
Blame Linus :)

Cheers,
Rusty.