Re: [PATCH] mask ADT: new mask.h file [2/22]

Rusty Russell
2004-04-06T05:00:25Z

On Mon, 2004-04-05 at 18:08, Paul Jackson wrote:
> > get rid of the
> > asm-generic/cpumask_optimized_for_large_smp_with_sparse_array_and_small_stack.h
>
> My mask patch does this.

Yes, which is why I'm such a fan.

> > then finally look at how ugly it would be to change users to
> > directly using the bitmap.h functions on cpumasks.
>
> That boils down to a very straightforward question. Do we ask
> them to write:
>
> cpus_or(s.bits, d1.bits, d2.bits)
>
> or:
>
> bitmap_or(s.bits, d1.bits, d2.bits, NR_CPUS);
>
> I prefer the first choice. It requires a thin cpumask.h header
> to wrap the bitmap ops, and add the final NR_CPUS to each one.

Well, you'd do presumably:
cpus_or(&s, &d1, &d2);

And make cpus_or() an inline so you get typechecking.

But my rough grepping reveals that there are around 420 uses of all the
cpu macros throughout the kernel. But if you merely implement:

any_online_cpu
cpumask_of_cpu
cpu_isset
cpu_set
cpu_clear

You'll have covered about 300 of them. I don't think a complete
abstraction is actually required or desirable: if someone wants to do
something tricky (like anding, oring, etc), there's nothing wrong with
accessing cpu.bits.

Thanks!
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell