Re: [PATCH] Introduce nodemask_t ADT [0/7]

From: Matthew Dobson
Date: Fri Mar 19 2004 - 18:11:57 EST


On Thu, 2004-03-18 at 18:04, Andi Kleen wrote:
> Matthew Dobson <colpatch@xxxxxxxxxx> writes:
>
> >> Chris Hellwig responded to it at the time asking why I didn't provide a
> >> single generic mask ADT, and make cpumask and nodemask instances of
> >> that.
> >
> > That is a better idea, if it can be made to work. My goal is to stop
>
> It already exists in linux/bitmap.h. I use that in NUMA API for the node masks.
>
> It's just a bit ugly to write because you have to always pass MAX_NUMNODES.
> Some wrappers would be prettier.
>
> -Andi

For MAX_NUMNODES > BITS_PER_LONG, thats just what these are. There are
just built-in optimizations for the single bit (UP for cpumask, non-NUMA
for nodemask) case and the single unsigned long case. For the case of a
single unsigned long, the bitmap operations aren't as efficient as just
doing a
res = (mask1 & mask2);
vs.
bitmask_and(&res, &mask1, &mask2);

Maybe I'm overly concerned about the speed of these ops at the expense
of code size. If that's the consensus, I'll gladly look at a simpler
implementation. As I said, my only real goal is to stop people open
coding these types of operations.

-Matt

-
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/