From: William Lee Irwin III <wli@holomorphy.com>
To: Paul Jackson <pj@sgi.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
akpm@osdl.org, linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [PATCH] Fix cpu iterator on empty bitmask
Date: Tue, 27 Apr 2004 18:57:03 -0700 [thread overview]
Message-ID: <20040428015703.GX743@holomorphy.com> (raw)
In-Reply-To: <20040427183135.6250f7bc.pj@sgi.com>
Rusty wrote:
>> Agreed, I'm pretty sure Paul's work doesn't make this mistake, but this
>> is a trivial patch for a real big which is causing oopses today.
>> Linus, please apply...
On Tue, Apr 27, 2004 at 06:31:35PM -0700, Paul Jackson wrote:
> agreed
Eh? Why are you now suddenly changing your tune from when I wrote a fix
for this and others just 10 days ago? The remainder of the missing fixes
below.
-- wli
Index: wli-2.6.5-mm6/include/asm-generic/cpumask_arith.h
===================================================================
--- wli-2.6.5-mm6.orig/include/asm-generic/cpumask_arith.h 2004-04-03 19:37:37.000000000 -0800
+++ wli-2.6.5-mm6/include/asm-generic/cpumask_arith.h 2004-04-17 19:11:53.000000000 -0700
@@ -15,17 +15,17 @@
#define cpus_or(dst,src1,src2) do { dst = (src1) | (src2); } while (0)
#define cpus_clear(map) do { map = 0; } while (0)
#define cpus_complement(map) do { map = ~(map); } while (0)
-#define cpus_equal(map1, map2) ((map1) == (map2))
-#define cpus_empty(map) ((map) == 0)
+#define cpus_equal(map1, map2) (!(((map1) ^ (map2)) & CPU_MASK_ALL))
+#define cpus_empty(map) (!((map) & CPU_MASK_ALL))
#define cpus_addr(map) (&(map))
#if BITS_PER_LONG == 32
-#define cpus_weight(map) hweight32(map)
+#define cpus_weight(map) hweight32((map) & CPU_MASK_ALL)
#elif BITS_PER_LONG == 64
-#define cpus_weight(map) hweight64(map)
+#define cpus_weight(map) hweight64((map) & CPU_MASK_ALL)
#endif
-#define cpus_shift_right(dst, src, n) do { dst = (src) >> (n); } while (0)
+#define cpus_shift_right(dst, src, n) do { dst = ((src) >> (n)) & CPU_MASK_ALL; } while (0)
#define cpus_shift_left(dst, src, n) do { dst = (src) << (n); } while (0)
#define any_online_cpu(map) \
@@ -39,11 +39,15 @@
#define CPU_MASK_NONE ((cpumask_t)0)
/* only ever use this for things that are _never_ used on large boxen */
-#define cpus_coerce(map) ((unsigned long)(map))
+#define cpus_coerce(map) ((unsigned long)(map) & CPU_MASK_ALL)
#define cpus_promote(map) ({ map; })
#define cpumask_of_cpu(cpu) ({ ((cpumask_t)1) << (cpu); })
-#define first_cpu(map) __ffs(map)
#define next_cpu(cpu, map) find_next_bit(&(map), NR_CPUS, cpu + 1)
+#define first_cpu(map) \
+({ \
+ cpumask_t __first_cpu_map__ = (map) & CPU_MASK_ALL; \
+ __first_cpu_map__ ? __ffs(__first_cpu_map__) : NR_CPUS; \
+})
#endif /* __ASM_GENERIC_CPUMASK_ARITH_H */
next prev parent reply other threads:[~2004-04-28 1:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-27 23:52 [PATCH] Fix cpu iterator on empty bitmask Rusty Russell
2004-04-28 0:05 ` William Lee Irwin III
2004-04-28 1:22 ` Rusty Russell
2004-04-28 1:31 ` Paul Jackson
2004-04-28 1:57 ` William Lee Irwin III [this message]
2004-04-28 2:18 ` Paul Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040428015703.GX743@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.com \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.