Re: [PATCH] mask ADT: bitmap and bitop tweaks [1/22]

From: Paul Jackson
Date: Mon Mar 29 2004 - 21:45:01 EST


> akpm, this is needed for mainline.

How urgent to you consider this fix (masking unused bits in the
arithmetic (single unsigned long word) cpumask implementation?

So far as I know, the only way to get high bits set with correct
invocations is by using cpus_complement(), which I don't see anyone
doing.

So I believe that this patch fixes latent bugs, not current bugs.

And it would be my preference (not surprisingly) to fix this in a way
that is consistent with my mask ADT proposal (avoid setting unused bits
on proper calls; don't filter on Boolean/scalar predicate evaluations):

+#if NR_CPUS % BITS_PER_LONG
+#define __CPU_VALID_MASK__ (~((1UL<< (NR_CPUS%BITS_PER_LONG) - 1))
+#else
+#define __CPU_VALID_MASK__ (~0UL)
+#endif

-#define cpus_complement(map) do { map = ~(map); } while (0)
+#define cpus_complement(map) \
+ do { map = ~(map) & __CPU_VALID_MASK__; } while (0)

_instead_ of changing the several other macros to follow the
bitmap convention (let the unused bits remain dont-care, until
resolving a Boolean or scalar predicate).

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
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/