From: Paul Jackson <pj@sgi.com>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Cc: Andi Kleen <ak@muc.de>, Ashok Raj <ashok.raj@intel.com>,
Christoph Hellwig <hch@infradead.org>,
Jesse Barnes <jbarnes@sgi.com>, Joe Korty <joe.korty@ccur.com>,
Manfred Spraul <manfred@colorfullife.com>,
Matthew Dobson <colpatch@us.ibm.com>,
Mikael Pettersson <mikpe@csd.uu.se>,
Nick Piggin <nickpiggin@yahoo.com.au>, Paul Jackson <pj@sgi.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Simon Derr <Simon.Derr@bull.net>,
William Lee Irwin III <wli@holomorphy.com>
Subject: [PATCH] cpumask 1/10 cpu_present_map real even on non-smp
Date: Thu, 3 Jun 2004 10:05:59 -0700 [thread overview]
Message-ID: <20040603100559.32c6db27.pj@sgi.com> (raw)
In-Reply-To: <20040603094339.03ddfd42.pj@sgi.com>
cpumask 1/10 cpu_present_map real even on non-smp
This patch makes cpu_present_map a real map for all
configurations, instead of a constant for non-SMP.
It also moves the definition of cpu_present_map out of
kernel/cpu.c into kernel/sched.c, because cpu.c isn't
compiled into non-SMP kernels.
The pattern is that each of the possible, present and
online cpu maps are actual kernel global cpumask_t
variables, for all configurations. They are documented
in include/linux/cpumask.h. Some of the UP (NR_CPUS=1)
code cheats, and hardcodes the assumption that the single
bit position of these maps is always set, as an optimization.
include/linux/cpumask.h | 13 +++++--------
kernel/cpu.c | 8 --------
kernel/sched.c | 10 ++++++++++
3 files changed, 15 insertions(+), 16 deletions(-)
Signed-off-by: Paul Jackson <pj@sgi.com>
Index: 2.6.7-rc2-mm2/include/linux/cpumask.h
===================================================================
--- 2.6.7-rc2-mm2.orig/include/linux/cpumask.h 2004-06-03 05:39:37.000000000 -0700
+++ 2.6.7-rc2-mm2/include/linux/cpumask.h 2004-06-03 05:56:00.000000000 -0700
@@ -10,15 +10,12 @@
extern cpumask_t cpu_online_map;
extern cpumask_t cpu_possible_map;
-extern cpumask_t cpu_present_map;
#define num_online_cpus() cpus_weight(cpu_online_map)
#define num_possible_cpus() cpus_weight(cpu_possible_map)
-#define num_present_cpus() cpus_weight(cpu_present_map)
#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
#define cpu_possible(cpu) cpu_isset(cpu, cpu_possible_map)
-#define cpu_present(cpu) cpu_isset(cpu, cpu_present_map)
#define for_each_cpu_mask(cpu, mask) \
for (cpu = first_cpu_const(mk_cpumask_const(mask)); \
@@ -27,25 +24,25 @@
#define for_each_cpu(cpu) for_each_cpu_mask(cpu, cpu_possible_map)
#define for_each_online_cpu(cpu) for_each_cpu_mask(cpu, cpu_online_map)
-#define for_each_present_cpu(cpu) for_each_cpu_mask(cpu, cpu_present_map)
#else
#define cpu_online_map cpumask_of_cpu(0)
#define cpu_possible_map cpumask_of_cpu(0)
-#define cpu_present_map cpumask_of_cpu(0)
#define num_online_cpus() 1
#define num_possible_cpus() 1
-#define num_present_cpus() 1
#define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; })
#define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; })
-#define cpu_present(cpu) ({ BUG_ON((cpu) != 0); 1; })
#define for_each_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
#define for_each_online_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
-#define for_each_present_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
#endif
+extern cpumask_t cpu_present_map;
+#define num_present_cpus() cpus_weight(cpu_present_map)
+#define cpu_present(cpu) cpu_isset(cpu, cpu_present_map)
+#define for_each_present_cpu(cpu) for_each_cpu_mask(cpu, cpu_present_map)
+
#define cpumask_scnprintf(buf, buflen, map) \
bitmap_scnprintf(buf, buflen, cpus_addr(map), NR_CPUS)
Index: 2.6.7-rc2-mm2/kernel/cpu.c
===================================================================
--- 2.6.7-rc2-mm2.orig/kernel/cpu.c 2004-06-03 05:39:46.000000000 -0700
+++ 2.6.7-rc2-mm2/kernel/cpu.c 2004-06-03 05:56:00.000000000 -0700
@@ -20,14 +20,6 @@
DECLARE_MUTEX(cpucontrol);
static struct notifier_block *cpu_chain;
-/*
- * Represents all cpu's present in the system
- * In systems capable of hotplug, this map could dynamically grow
- * as new cpu's are detected in the system via any platform specific
- * method, such as ACPI for e.g.
- */
-cpumask_t cpu_present_map;
-EXPORT_SYMBOL(cpu_present_map);
/* Need to know about CPUs going up/down? */
int register_cpu_notifier(struct notifier_block *nb)
Index: 2.6.7-rc2-mm2/kernel/sched.c
===================================================================
--- 2.6.7-rc2-mm2.orig/kernel/sched.c 2004-06-03 05:46:32.000000000 -0700
+++ 2.6.7-rc2-mm2/kernel/sched.c 2004-06-03 05:56:00.000000000 -0700
@@ -3109,6 +3109,16 @@
return retval;
}
+/*
+ * Represents all cpu's present in the system
+ * In systems capable of hotplug, this map could dynamically grow
+ * as new cpu's are detected in the system via any platform specific
+ * method, such as ACPI for e.g.
+ */
+
+cpumask_t cpu_present_map;
+EXPORT_SYMBOL(cpu_present_map);
+
/**
* sys_sched_getaffinity - get the cpu affinity of a process
* @pid: pid of the process
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
next prev parent reply other threads:[~2004-06-03 17:48 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-03 16:43 [PATCH] Bitmap and Cpumask Cleanup - Overview Paul Jackson
2004-06-03 17:05 ` Paul Jackson [this message]
2004-06-03 17:09 ` [PATCH] cpumask 2/10 bitmap cleanup preparation for cpumask overhaul Paul Jackson
2004-06-03 17:09 ` [PATCH] cpumask 3/10 bitmap inlining and optimizations Paul Jackson
2004-06-03 17:09 ` [PATCH] cpumask 4/10 uninline find_next_bit on ia64 Paul Jackson
2004-06-03 17:10 ` [PATCH] cpumask 5/10 rewrite cpumask.h - single bitmap based implementation Paul Jackson
2004-06-04 0:07 ` Andrew Morton
2004-06-04 0:25 ` Andrew Morton
2004-06-04 2:58 ` Paul Jackson
2004-06-04 2:47 ` Paul Jackson
2004-06-04 2:54 ` David S. Miller
2004-06-04 5:02 ` Paul Jackson
2004-06-04 5:01 ` David S. Miller
2004-06-04 1:47 ` Rusty Russell
2004-06-04 2:02 ` Nick Piggin
2004-06-04 2:19 ` Rusty Russell
2004-06-04 5:18 ` Paul Jackson
2004-06-04 5:22 ` David S. Miller
2004-06-04 6:57 ` Paul Jackson
2004-06-04 9:31 ` Mikael Pettersson
2004-06-04 9:37 ` William Lee Irwin III
2004-06-04 9:46 ` Mikael Pettersson
2004-06-04 9:59 ` William Lee Irwin III
2004-06-04 11:16 ` Mikael Pettersson
2004-06-04 11:27 ` William Lee Irwin III
2004-06-04 11:32 ` William Lee Irwin III
2004-06-04 16:23 ` Paul Jackson
2004-06-04 16:28 ` William Lee Irwin III
2004-06-04 17:47 ` Paul Jackson
2004-06-04 18:12 ` William Lee Irwin III
2004-06-04 18:20 ` William Lee Irwin III
2004-06-04 18:27 ` Andrew Morton
2004-06-04 18:38 ` William Lee Irwin III
2004-06-05 2:51 ` William Lee Irwin III
2004-06-05 3:29 ` William Lee Irwin III
2004-06-04 18:42 ` Paul Jackson
2004-06-04 18:42 ` William Lee Irwin III
2004-06-05 6:48 ` Paul Jackson
2004-06-06 2:07 ` Rusty Russell
2004-06-06 12:16 ` Paul Jackson
2004-06-06 12:13 ` William Lee Irwin III
2004-06-06 12:28 ` Paul Jackson
2004-06-06 12:36 ` William Lee Irwin III
2004-06-06 13:42 ` Paul Jackson
2004-06-06 23:20 ` Rusty Russell
2004-06-07 6:44 ` Paul Jackson
2004-06-04 9:41 ` Andrew Morton
2004-06-05 7:01 ` Paul Jackson
2004-06-04 16:03 ` Paul Jackson
2004-06-04 16:56 ` William Lee Irwin III
2004-06-04 17:29 ` Paul Jackson
2004-06-04 17:52 ` William Lee Irwin III
2004-06-04 19:01 ` Paul Jackson
2004-06-04 19:08 ` Anton Blanchard
2004-06-04 19:17 ` William Lee Irwin III
2004-06-04 20:28 ` Andrew Morton
2004-06-07 7:55 ` Anton Blanchard
2004-06-05 7:28 ` Paul Jackson
2004-06-06 8:07 ` Paul Jackson
2004-06-06 8:16 ` William Lee Irwin III
2004-06-05 0:05 ` Paul Jackson
2004-06-05 1:31 ` William Lee Irwin III
2004-06-05 8:04 ` Paul Jackson
2004-06-05 8:26 ` William Lee Irwin III
2004-06-06 8:40 ` Paul Jackson
2004-06-06 12:34 ` Paul Jackson
2004-06-07 16:54 ` fix up compat_sched_[get/set]affinity Joe Korty
2004-06-07 17:07 ` William Lee Irwin III
2004-06-04 5:30 ` [PATCH] cpumask 5/10 rewrite cpumask.h - single bitmap based implementation Paul Jackson
2004-06-04 5:35 ` Nick Piggin
2004-06-04 5:40 ` Andrew Morton
2004-06-04 5:53 ` Nick Piggin
2004-06-04 6:47 ` Paul Jackson
2004-06-04 4:31 ` Paul Jackson
2004-06-04 8:19 ` William Lee Irwin III
2004-06-04 8:43 ` Keith Owens
2004-06-04 9:54 ` William Lee Irwin III
2004-06-04 17:08 ` Paul Jackson
2004-06-09 16:38 ` William Lee Irwin III
2004-06-04 9:14 ` Paul Jackson
2004-06-03 17:10 ` [PATCH] cpumask 6/10 remove 26 no longer used cpumask*.h files Paul Jackson
2004-06-03 17:10 ` [PATCH] cpumask 7/10 remove obsolete cpumask macro uses - i386 arch Paul Jackson
2004-06-03 17:10 ` [PATCH] cpumask 8/10 remove obsolete cpumask macro uses - other archs Paul Jackson
2004-06-03 17:11 ` [PATCH] cpumask 9/10 Remove no longer used obsolete macro emulation Paul Jackson
2004-06-03 17:11 ` [PATCH] cpumask 10/10 optimize various uses of new cpumasks Paul Jackson
2004-06-04 4:27 ` Rusty Russell
2004-06-04 4:40 ` Nick Piggin
2004-06-04 4:51 ` Paul Jackson
2004-06-09 0:09 ` PATCH] cpumask 11/10 comment, spacing tweaks 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=20040603100559.32c6db27.pj@sgi.com \
--to=pj@sgi.com \
--cc=Simon.Derr@bull.net \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=ashok.raj@intel.com \
--cc=colpatch@us.ibm.com \
--cc=hch@infradead.org \
--cc=jbarnes@sgi.com \
--cc=joe.korty@ccur.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=mikpe@csd.uu.se \
--cc=nickpiggin@yahoo.com.au \
--cc=rusty@rustcorp.com.au \
--cc=wli@holomorphy.com \
/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