public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: linux-kernel@vger.kernel.org
Subject: [RFC,PATCH] use nonatomic bitops for cpumask_t
Date: Sat, 29 May 2004 10:57:21 +0200	[thread overview]
Message-ID: <40B85071.8090402@colorfullife.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

Hi,

The default implementation for cpumasks in <asm-generic/cpumask*> uses 
atomic bitops for the operations that affect a single cpu and nonatomic 
operations for the rest.
What about switching to nonatomic operations for all operations? I'm 
checking for callers that rely on the atomicity of the bitops, but so 
far everyone has it's own locks.

--
    Manfred

[-- Attachment #2: patch-nonatomic-cpumask --]
[-- Type: text/plain, Size: 2574 bytes --]

diff -u 2.6/include/asm-generic/cpumask_arith.h build-2.6/include/asm-generic/cpumask_arith.h
--- 2.6/include/asm-generic/cpumask_arith.h	2004-05-23 21:08:51.000000000 +0200
+++ build-2.6/include/asm-generic/cpumask_arith.h	2004-05-29 10:34:53.000000000 +0200
@@ -6,10 +6,10 @@
  * to contain the whole cpu bitmap.
  */
 
-#define cpu_set(cpu, map)		set_bit(cpu, &(map))
-#define cpu_clear(cpu, map)		clear_bit(cpu, &(map))
+#define cpu_set(cpu, map)		__set_bit(cpu, &(map))
+#define cpu_clear(cpu, map)		__clear_bit(cpu, &(map))
 #define cpu_isset(cpu, map)		test_bit(cpu, &(map))
-#define cpu_test_and_set(cpu, map)	test_and_set_bit(cpu, &(map))
+#define cpu_test_and_set(cpu, map)	__test_and_set_bit(cpu, &(map))
 
 #define cpus_and(dst,src1,src2)		do { dst = (src1) & (src2); } while (0)
 #define cpus_or(dst,src1,src2)		do { dst = (src1) | (src2); } while (0)
diff -u 2.6/include/asm-generic/cpumask_array.h build-2.6/include/asm-generic/cpumask_array.h
--- 2.6/include/asm-generic/cpumask_array.h	2004-05-23 21:08:51.000000000 +0200
+++ build-2.6/include/asm-generic/cpumask_array.h	2004-05-29 10:35:19.000000000 +0200
@@ -9,10 +9,10 @@
 
 #define CPU_ARRAY_SIZE		BITS_TO_LONGS(NR_CPUS)
 
-#define cpu_set(cpu, map)		set_bit(cpu, (map).mask)
-#define cpu_clear(cpu, map)		clear_bit(cpu, (map).mask)
-#define cpu_isset(cpu, map)		test_bit(cpu, (map).mask)
-#define cpu_test_and_set(cpu, map)	test_and_set_bit(cpu, (map).mask)
+#define cpu_set(cpu, map)		__set_bit(cpu, (map).mask)
+#define cpu_clear(cpu, map)		__clear_bit(cpu, (map).mask)
+#define cpu_isset(cpu, map)		__test_bit(cpu, (map).mask)
+#define cpu_test_and_set(cpu, map)	__test_and_set_bit(cpu, (map).mask)
 
 #define cpus_and(dst,src1,src2)	bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS)
 #define cpus_or(dst,src1,src2)	bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS)
diff -u 2.6/include/asm-generic/cpumask_up.h build-2.6/include/asm-generic/cpumask_up.h
--- 2.6/include/asm-generic/cpumask_up.h	2004-01-09 07:59:19.000000000 +0100
+++ build-2.6/include/asm-generic/cpumask_up.h	2004-05-29 10:41:25.000000000 +0200
@@ -6,7 +6,7 @@
 #define cpu_set(cpu, map)		do { (void)(cpu); cpus_coerce(map) = 1UL; } while (0)
 #define cpu_clear(cpu, map)		do { (void)(cpu); cpus_coerce(map) = 0UL; } while (0)
 #define cpu_isset(cpu, map)		((void)(cpu), cpus_coerce(map) != 0UL)
-#define cpu_test_and_set(cpu, map)	((void)(cpu), test_and_set_bit(0, &(map)))
+#define cpu_test_and_set(cpu, map)	((void)(cpu), __test_and_set_bit(0, &(map)))
 
 #define cpus_and(dst, src1, src2)					\
 	do {								\

             reply	other threads:[~2004-05-29  8:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-29  8:57 Manfred Spraul [this message]
2004-05-29  9:46 ` [RFC,PATCH] use nonatomic bitops for cpumask_t Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2004-05-29 11:02 Mikael Pettersson

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=40B85071.8090402@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox