Messages in this thread Patch in this message | | | Date | Sat, 31 Jul 2004 13:57:57 -0700 | From | William Lee Irwin III <> | Subject | Re: [PATCH][2.6] first/next_cpu returns values > NR_CPUS |
| |
On Sat, Jul 31, 2004 at 04:52:18PM -0400, Zwane Mwaikambo wrote: > The following caused some fireworks whilst merging i386 cpu hotplug. > any_online_cpu(0x2) returns 32 on i386 if we're forced to continue past > the only set bit due to the additional find_first_bit in the > find_next_bit i386 implementation. Not wanting to change current > behaviour in the bitops primitives and since the NR_CPUS thing is a > cpumask issue, i've opted to fix next_cpu() and first_cpu() instead. > Signed-off-by: Zwane Mwaikambo <zwane@fsmlabs.com>
This might save a couple of lines of code.
Index: hotplug-2.6.8-rc2/include/linux/cpumask.h =================================================================== --- hotplug-2.6.8-rc2.orig/include/linux/cpumask.h 2004-07-29 04:44:59.000000000 -0700 +++ hotplug-2.6.8-rc2/include/linux/cpumask.h 2004-07-31 13:49:15.647650104 -0700 @@ -207,13 +207,13 @@ #define first_cpu(src) __first_cpu(&(src), NR_CPUS) static inline int __first_cpu(const cpumask_t *srcp, int nbits) { - return find_first_bit(srcp->bits, nbits); + return min(NR_CPUS, find_first_bit(srcp->bits, nbits)); } #define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS) static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits) { - return find_next_bit(srcp->bits, nbits, n+1); + return min(NR_CPUS, find_next_bit(srcp->bits, nbits, n+1)); } #define cpumask_of_cpu(cpu) \ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |