Re: [RFC] CPUMASK: proposal for replacing cpumask_t

From: Rusty Russell
Date: Fri Sep 12 2008 - 00:55:29 EST


On Thursday 11 September 2008 08:47:58 Mike Travis wrote:
> Here's an initial proposal for abstracting cpumask_t to be either
> an array of 1 or a pointer to an array... Hopefully this will
> minimize the amount of code changes while providing the capabilities
> this change is attempting to do.
>
> Comments most welcome. ;-)

I think this is still "wrong way go back".

I'm yet to be convinced that we really need to allocate cpumasks in any fast
paths. And if not, we should simply allocate them everywhere. I'd rather
see one #ifdef around a place where we can show a perf issue.

Get rid of CPU_MASK_ALL et al in favour of cpu_mask_all. And cpu_mask_any_one
instead of CPU_MASK_CPU0 since that's usually what they want.

API looks like so (look Ma, no typedefs!)

struct cpumask *cpus;

cpus = cpumask_alloc();
if (!cpus)
return -ENOMEM;

cpumask_init_single(cpunum);
OR
cpumask_init(cpu_mask_all);
...
cpumask_free(cpus);

Unmistakable and really hard to screw up. You can even be clever and not
reveal the struct cpumask definition so noone can declare one by accident...

Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/