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

Rusty Russell
2004-04-07T00:03:25Z

On Tue, 2004-04-06 at 20:40, Paul Jackson wrote:
> Rusty - thank-you very much for your constructive feedback so far.
>
> Seems to me that we are in agreement that slimming down the
> internals of cpumask_t is worth proceeding with, but not on possible
> changes to the cpumask API seen by the rest of the kernel.

OK, cool. We can have that debate later.

> static inline void bitmap_and(unsigned long *d, const unsigned long *s1,
> const unsigned long *s2, int nbits)
> {
> if (nbits <= BITS_PER_LONG)
> d[0] = s1[0] & s2[0];
> else
> _bitmap_and(d, s1, s2, nbits);
> }

Two suggestions:
1) I think you only want the fastpath when it's eliminated by the
compiler, so perhaps:
if (__builtin_constant_p(nbits) && nbits <= BITS_PER_LONG)

2) The normal kernel naming scheme is two underscores (__bitmap_and),
probably because it's clearer visually.

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