* [PATCH mask 1/15] pj-fix-1-unifix
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
@ 2004-05-06 18:46 ` Paul Jackson
2004-05-06 20:05 ` Matt Mackall
2004-05-06 18:48 ` [PATCH mask 2/15] pj-fix-2-ashoks-updated-cpuhotplug-6-7 Paul Jackson
` (14 subsequent siblings)
15 siblings, 1 reply; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:46 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
From: "Randy.Dunlap" <rddunlap@osdl.org>
There is a general desire to reduce the quantity of noisy and/or
outdated kernel boot-time messages...
Suggested by Andi Kleen.
Ulrich's (old) comments:
http://www.nsa.gov/selinux/list-archive/0107/0525.cfm
Certifying Linux (Linux Journal):
http://www.linuxjournal.com/article.php?sid=0131
Index: 2.6.6-rc3-mm2/init/main.c
===================================================================
--- 2.6.6-rc3-mm2.orig/init/main.c 2004-05-05 06:11:32.000000000 -0700
+++ 2.6.6-rc3-mm2/init/main.c 2004-05-05 06:27:12.000000000 -0700
@@ -521,7 +521,6 @@
proc_root_init();
#endif
check_bugs();
- printk("POSIX conformance testing by UNIFIX\n");
/*
* We count on the initial thread going ok
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH mask 1/15] pj-fix-1-unifix
2004-05-06 18:46 ` [PATCH mask 1/15] pj-fix-1-unifix Paul Jackson
@ 2004-05-06 20:05 ` Matt Mackall
2004-05-06 20:15 ` Paul Jackson
2004-05-06 20:36 ` Paul Jackson
0 siblings, 2 replies; 20+ messages in thread
From: Matt Mackall @ 2004-05-06 20:05 UTC (permalink / raw)
To: Paul Jackson
Cc: Andrew Morton, linux-kernel, Matthew Dobson,
William Lee Irwin III, Rusty Russell, Joe Korty, Jesse Barnes
On Thu, May 06, 2004 at 11:46:29AM -0700, Paul Jackson wrote:
> - printk("POSIX conformance testing by UNIFIX\n");
While this may make sense, I really don't see how it has anything to
do with the series.
--
Matt Mackall : http://www.selenic.com : Linux development and consulting
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH mask 1/15] pj-fix-1-unifix
2004-05-06 20:05 ` Matt Mackall
@ 2004-05-06 20:15 ` Paul Jackson
2004-05-06 20:36 ` Paul Jackson
1 sibling, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 20:15 UTC (permalink / raw)
To: Matt Mackall; +Cc: akpm, linux-kernel, colpatch, wli, rusty, joe.korty, jbarnes
Matt wrote:
> I really don't see how it has anything to do with the series.
It doesn't have anything to do with the series.
The 2.6.6-rc3-mm2 patch set could not be built (and that unifix patch
could not even be applied as a patch - due to being malformed). So I
could not build and test the bitmap/cpumask patch against a vanilla
2.6.6-rc3-mm2. Therefore I included a set of pj-fix-* patches, to get
2.6.6-rc3-mm2 healthy, before including the real bitmap/cpumask patches.
Notice that some patches are named pj-fix-*, and others named mask*.
And notice in the opening "[PATCH mask 0/15] bitmap and cpumask cleanup"
where I write:
pj-fix-1-unifix
pj-fix-2-ashoks-updated-cpuhotplug-6-7
pj-fix-3-ashoks-updated-cpuhotplug-7-7
pj-fix-4-include-mempolicy
pj-fix-5-syscall-return-semicolon
Patches pj-fix-* should match fixes that you (Andrew)
have already picked up. You should ignore these
if what you already have is just as good. They are
here so that I can be precise as to what source I
am using for the basis of the following patches.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH mask 1/15] pj-fix-1-unifix
2004-05-06 20:05 ` Matt Mackall
2004-05-06 20:15 ` Paul Jackson
@ 2004-05-06 20:36 ` Paul Jackson
1 sibling, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 20:36 UTC (permalink / raw)
To: Matt Mackall; +Cc: akpm, linux-kernel, colpatch, wli, rusty, joe.korty, jbarnes
Oh - I was working from Andrew's broken-out patch set, not the
monolithic patch. If I had been using the monolithic patch, then I
probably wouldn't have noticed this broken unifix patch. Oh well.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH mask 2/15] pj-fix-2-ashoks-updated-cpuhotplug-6-7
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
2004-05-06 18:46 ` [PATCH mask 1/15] pj-fix-1-unifix Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 3/15] pj-fix-3-ashoks-updated-cpuhotplug-7-7 Paul Jackson
` (13 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
Name: cpu_present_map.patch
Author: Ashok Raj (Intel Corporation)
D: This patch adds cpu_present_map, cpu_present() and for_each_cpu_present()
D: to distinguish between possible cpu's in a system and cpu's physically
D: present in a system. Before cpu hotplug was introduced cpu_possible()
D: represented cpu's physically present in the system. With hotplug capable
D: Kernel, there is a requirement to distinguish a cpu as possible verses a
D: CPU physically present in the system. This is required so thta when
D: smp_init() attempts to start all cpu's it should now only attempt
D: to start cpu's present in the system. When a hotplug cpu is
D: physically inserted cpu_present_map will have bits updated
D: dynamically.
Index: 2.6.6-rc3-mm2-bitmapv5/arch/ia64/kernel/smpboot.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/ia64/kernel/smpboot.c 2004-05-06 03:57:36.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/ia64/kernel/smpboot.c 2004-05-06 04:22:43.000000000 -0700
@@ -75,11 +75,11 @@
task_t *task_for_booting_cpu;
-/* Bitmask of currently online CPUs */
+/* Bitmasks of currently online, and possible CPUs */
cpumask_t cpu_online_map;
EXPORT_SYMBOL(cpu_online_map);
-cpumask_t phys_cpu_present_map;
-EXPORT_SYMBOL(phys_cpu_present_map);
+cpumask_t cpu_possible_map;
+EXPORT_SYMBOL(cpu_possible_map);
/* which logical CPU number maps to which CPU (physical APIC ID) */
volatile int ia64_cpu_to_sapicid[NR_CPUS];
@@ -99,6 +99,7 @@
nointroute (char *str)
{
no_int_routing = 1;
+ printk ("no_int_routing on\n");
return 1;
}
@@ -441,14 +442,15 @@
ia64_cpu_to_sapicid[cpu] = -1;
ia64_cpu_to_sapicid[0] = boot_cpu_id;
- cpus_clear(phys_cpu_present_map);
- cpu_set(0, phys_cpu_present_map);
-
+ cpus_clear(cpu_present_map);
+ cpu_set(0, cpu_present_map);
+ cpu_set(0, cpu_possible_map);
for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) {
sapicid = smp_boot_data.cpu_phys_id[i];
if (sapicid == boot_cpu_id)
continue;
- cpu_set(cpu, phys_cpu_present_map);
+ cpu_set(cpu, cpu_present_map);
+ cpu_set(cpu, cpu_possible_map);
ia64_cpu_to_sapicid[cpu] = sapicid;
cpu++;
}
@@ -529,9 +531,11 @@
if (!max_cpus) {
printk(KERN_INFO "SMP mode deactivated.\n");
cpus_clear(cpu_online_map);
- cpus_clear(phys_cpu_present_map);
+ cpus_clear(cpu_present_map);
+ cpus_clear(cpu_possible_map);
cpu_set(0, cpu_online_map);
- cpu_set(0, phys_cpu_present_map);
+ cpu_set(0, cpu_present_map);
+ cpu_set(0, cpu_possible_map);
return;
}
}
Index: 2.6.6-rc3-mm2-bitmapv5/include/linux/cpumask.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/linux/cpumask.h 2004-05-06 03:50:12.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/linux/cpumask.h 2004-05-06 04:22:43.000000000 -0700
@@ -10,11 +10,15 @@
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)); \
@@ -23,16 +27,23 @@
#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
#define cpumask_scnprintf(buf, buflen, map) \
Index: 2.6.6-rc3-mm2-bitmapv5/init/main.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/init/main.c 2004-05-06 04:22:41.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/init/main.c 2004-05-06 04:22:43.000000000 -0700
@@ -360,10 +360,10 @@
unsigned j = 1;
/* FIXME: This should be done in userspace --RR */
- for (i = 0; i < NR_CPUS; i++) {
+ for_each_present_cpu(i) {
if (num_online_cpus() >= max_cpus)
break;
- if (cpu_possible(i) && !cpu_online(i)) {
+ if (!cpu_online(i)) {
cpu_up(i);
j++;
}
@@ -620,6 +620,22 @@
execve(init_filename, argv_init, envp_init);
}
+static void fixup_cpu_present_map(void)
+{
+ int i;
+
+ /*
+ * If arch is not hotplug ready and did not populate
+ * cpu_present_map, just make cpu_present_map same as cpu_possible_map
+ * for other cpu bringup code to function as normal. e.g smp_init() etc.
+ */
+ if (cpus_empty(cpu_present_map)) {
+ for_each_cpu(i) {
+ cpu_set(i, cpu_present_map);
+ }
+ }
+}
+
static int init(void * unused)
{
lock_kernel();
@@ -638,6 +654,7 @@
do_pre_smp_initcalls();
+ fixup_cpu_present_map();
smp_init();
sched_init_smp();
do_basic_setup();
Index: 2.6.6-rc3-mm2-bitmapv5/kernel/cpu.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/kernel/cpu.c 2004-05-06 03:57:16.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/kernel/cpu.c 2004-05-06 04:22:43.000000000 -0700
@@ -20,6 +20,14 @@
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)
@@ -180,7 +188,7 @@
if ((ret = down_interruptible(&cpucontrol)) != 0)
return ret;
- if (cpu_online(cpu)) {
+ if (cpu_online(cpu) || !cpu_present(cpu)) {
ret = -EINVAL;
goto out;
}
Index: 2.6.6-rc3-mm2-bitmapv5/fs/proc/proc_misc.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/fs/proc/proc_misc.c 2004-05-06 03:57:24.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/fs/proc/proc_misc.c 2004-05-06 04:22:43.000000000 -0700
@@ -371,7 +371,7 @@
if (wall_to_monotonic.tv_nsec)
--jif;
- for_each_cpu(i) {
+ for_each_online_cpu(i) {
int j;
user += kstat_cpu(i).cpustat.user;
@@ -393,7 +393,7 @@
(unsigned long long)jiffies_64_to_clock_t(iowait),
(unsigned long long)jiffies_64_to_clock_t(irq),
(unsigned long long)jiffies_64_to_clock_t(softirq));
- for_each_cpu(i) {
+ for_each_online_cpu(i) {
/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
user = kstat_cpu(i).cpustat.user;
Index: 2.6.6-rc3-mm2-bitmapv5/kernel/sched.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/kernel/sched.c 2004-05-06 04:00:27.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/kernel/sched.c 2004-05-06 04:22:43.000000000 -0700
@@ -1219,7 +1219,7 @@
{
unsigned long i, sum = 0;
- for_each_cpu(i)
+ for_each_online_cpu(i)
sum += cpu_rq(i)->nr_uninterruptible;
return sum;
@@ -1229,7 +1229,7 @@
{
unsigned long long i, sum = 0;
- for_each_cpu(i)
+ for_each_online_cpu(i)
sum += cpu_rq(i)->nr_switches;
return sum;
@@ -1239,7 +1239,7 @@
{
unsigned long i, sum = 0;
- for_each_cpu(i)
+ for_each_online_cpu(i)
sum += atomic_read(&cpu_rq(i)->nr_iowait);
return sum;
Index: 2.6.6-rc3-mm2-bitmapv5/fs/buffer.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/fs/buffer.c 2004-05-06 04:00:27.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/fs/buffer.c 2004-05-06 04:22:43.000000000 -0700
@@ -2989,7 +2989,7 @@
if (__get_cpu_var(bh_accounting).ratelimit++ < 4096)
return;
__get_cpu_var(bh_accounting).ratelimit = 0;
- for_each_cpu(i)
+ for_each_online_cpu(i)
tot += per_cpu(bh_accounting, i).nr;
buffer_heads_over_limit = (tot > max_buffer_heads);
}
Index: 2.6.6-rc3-mm2-bitmapv5/kernel/fork.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/kernel/fork.c 2004-05-06 03:57:16.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/kernel/fork.c 2004-05-06 04:22:43.000000000 -0700
@@ -63,7 +63,7 @@
int cpu;
int total = 0;
- for_each_cpu(cpu)
+ for_each_online_cpu(cpu)
total += per_cpu(process_counts, cpu);
return total;
Index: 2.6.6-rc3-mm2-bitmapv5/kernel/timer.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/kernel/timer.c 2004-05-06 03:50:20.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/kernel/timer.c 2004-05-06 04:22:43.000000000 -0700
@@ -332,7 +332,7 @@
del_again:
ret += del_timer(timer);
- for_each_cpu(i) {
+ for_each_online_cpu(i) {
base = &per_cpu(tvec_bases, i);
if (base->running_timer == timer) {
while (base->running_timer == timer) {
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-ia64/smp.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-ia64/smp.h 2004-05-06 03:57:36.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-ia64/smp.h 2004-05-06 04:22:43.000000000 -0700
@@ -38,7 +38,6 @@
extern char no_int_routing __devinitdata;
-extern cpumask_t phys_cpu_present_map;
extern cpumask_t cpu_online_map;
extern unsigned long ipi_base_addr;
extern unsigned char smp_int_redirect;
@@ -48,8 +47,6 @@
extern unsigned long ap_wakeup_vector;
-#define cpu_possible_map phys_cpu_present_map
-
/*
* Function to map hard smp processor id to logical id. Slow, so don't use this in
* performance-critical code.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 3/15] pj-fix-3-ashoks-updated-cpuhotplug-7-7
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
2004-05-06 18:46 ` [PATCH mask 1/15] pj-fix-1-unifix Paul Jackson
2004-05-06 18:48 ` [PATCH mask 2/15] pj-fix-2-ashoks-updated-cpuhotplug-6-7 Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 4/15] pj-fix-4-include-mempolicy Paul Jackson
` (12 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
Name: hotcpu_ia64.patch
Author: Ashok Raj (Intel Corporation)
D: Supports basic ability to enable hotplug functions for IA64.
D: Code is just evolving, and there are several loose ends to tie up.
D:
D: What this code drop does
D: - Support logical online and offline
D: - Handles interrupt migration without loss of interrupts.
D: - Handles stress fine > 24+ hrs with make -j/ftp/rcp workloads
D: - Handles irq migration from a dying cpu without loss of interrupts.
D: What needs to be done
D: - Boot CPU removal support, with platform level authentication
D: - Putting cpu being removed in BOOT_RENDEZ mode.
---
linux-2.6.6-rc3-root/arch/ia64/Kconfig | 9 +
linux-2.6.6-rc3-root/arch/ia64/kernel/iosapic.c | 7 -
linux-2.6.6-rc3-root/arch/ia64/kernel/irq.c | 103 +++++++++++++++++
linux-2.6.6-rc3-root/arch/ia64/kernel/irq_ia64.c | 60 +++++++++-
linux-2.6.6-rc3-root/arch/ia64/kernel/process.c | 43 +++++++
linux-2.6.6-rc3-root/arch/ia64/kernel/sal.c | 13 ++
linux-2.6.6-rc3-root/arch/ia64/kernel/smp.c | 26 ++++
linux-2.6.6-rc3-root/arch/ia64/kernel/smpboot.c | 136 +++++++++++++++++++++--
linux-2.6.6-rc3-root/arch/ia64/kernel/time.c | 5
linux-2.6.6-rc3-root/include/asm-ia64/smp.h | 2
10 files changed, 386 insertions(+), 18 deletions(-)
diff -puN arch/ia64/Kconfig~hotcpu_ia64 arch/ia64/Kconfig
--- linux-2.6.6-rc3/arch/ia64/Kconfig~hotcpu_ia64 2004-05-04 20:52:19.527778099 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/Kconfig 2004-05-04 20:52:19.553168737 -0700
@@ -78,6 +78,15 @@ config IA64_HP_SIM
endchoice
+config HOTPLUG_CPU
+ bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
+ depends on SMP && HOTPLUG && EXPERIMENTAL
+ default n
+ ---help---
+ Say Y here to experiment with turning CPUs off and on. CPUs
+ can be controlled through /sys/devices/system/cpu/cpu#.
+ Say N if you want to disable cpu hotplug.
+
choice
prompt "Processor type"
default ITANIUM
diff -puN arch/ia64/kernel/irq.c~hotcpu_ia64 arch/ia64/kernel/irq.c
--- linux-2.6.6-rc3/arch/ia64/kernel/irq.c~hotcpu_ia64 2004-05-04 20:52:19.529731225 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/irq.c 2004-05-04 20:52:19.554145300 -0700
@@ -8,6 +8,12 @@
* instead of just grabbing them. Thus setups with different IRQ numbers
* shouldn't result in any weird surprises, and installing new handlers
* should be easier.
+ *
+ * Copyright (C) Ashok Raj<ashok.raj@intel.com>, Intel Corporation 2004
+ *
+ * 4/14/2004: Added code to handle cpu migration and do safe irq
+ * migration without lossing interrupts for iosapic
+ * architecture.
*/
/*
@@ -27,6 +33,7 @@
#include <linux/timex.h>
#include <linux/slab.h>
#include <linux/random.h>
+#include <linux/cpu.h>
#include <linux/ctype.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
@@ -35,14 +42,17 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/kallsyms.h>
+#include <linux/notifier.h>
#include <asm/atomic.h>
+#include <asm/cpu.h>
#include <asm/io.h>
#include <asm/smp.h>
#include <asm/system.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
+#include <asm/tlbflush.h>
#include <asm/delay.h>
#include <asm/irq.h>
@@ -1006,6 +1016,99 @@ static int irq_affinity_write_proc (stru
#endif /* CONFIG_SMP */
+#ifdef CONFIG_HOTPLUG_CPU
+unsigned int vectors_in_migration[NR_IRQS];
+
+/*
+ * Since cpu_online_map is already updated, we just need to check for
+ * affinity that has zeros
+ */
+static void migrate_irqs(void)
+{
+ cpumask_t mask;
+ irq_desc_t *desc;
+ int irq, new_cpu;
+
+ for (irq=0; irq < NR_IRQS; irq++) {
+ desc = irq_descp(irq);
+
+ /*
+ * No handling for now.
+ * TBD: Implement a disable function so we can now
+ * tell CPU not to respond to these local intr sources.
+ * such as ITV,CPEI,MCA etc.
+ */
+ if (desc->status == IRQ_PER_CPU)
+ continue;
+
+ cpus_and(mask, irq_affinity[irq], cpu_online_map);
+ if (any_online_cpu(mask) == NR_CPUS) {
+ /*
+ * Save it for phase 2 processing
+ */
+ vectors_in_migration[irq] = irq;
+
+ new_cpu = any_online_cpu(cpu_online_map);
+ mask = cpumask_of_cpu(new_cpu);
+
+ /*
+ * Al three are essential, currently WARN_ON.. maybe panic?
+ */
+ if (desc->handler && desc->handler->disable &&
+ desc->handler->enable && desc->handler->set_affinity) {
+ desc->handler->disable(irq);
+ desc->handler->set_affinity(irq, mask);
+ desc->handler->enable(irq);
+ } else {
+ WARN_ON((!(desc->handler) || !(desc->handler->disable) ||
+ !(desc->handler->enable) ||
+ !(desc->handler->set_affinity)));
+ }
+ }
+ }
+}
+
+void fixup_irqs(void)
+{
+ unsigned int irq;
+ extern void ia64_process_pending_intr(void);
+
+ ia64_set_itv(1<<16);
+ /*
+ * Phase 1: Locate irq's bound to this cpu and
+ * relocate them for cpu removal.
+ */
+ migrate_irqs();
+
+ /*
+ * Phase 2: Perform interrupt processing for all entries reported in
+ * local APIC.
+ */
+ ia64_process_pending_intr();
+
+ /*
+ * Phase 3: Now handle any interrupts not captured in local APIC.
+ * This is to account for cases that device interrupted during the time the
+ * rte was being disabled and re-programmed.
+ */
+ for (irq=0; irq < NR_IRQS; irq++) {
+ if (vectors_in_migration[irq]) {
+ vectors_in_migration[irq]=0;
+ do_IRQ(irq, NULL);
+ }
+ }
+
+ /*
+ * Now let processor die. We do irq disable and max_xtp() to
+ * ensure there is no more interrupts routed to this processor.
+ * But the local timer interrupt can have 1 pending which we
+ * take care in timer_interrupt().
+ */
+ max_xtp();
+ local_irq_disable();
+}
+#endif
+
static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
int count, int *eof, void *data)
{
diff -puN arch/ia64/kernel/process.c~hotcpu_ia64 arch/ia64/kernel/process.c
--- linux-2.6.6-rc3/arch/ia64/kernel/process.c~hotcpu_ia64 2004-05-04 20:52:19.530707788 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/process.c 2004-05-04 20:52:19.554145300 -0700
@@ -7,6 +7,7 @@
#define __KERNEL_SYSCALLS__ /* see <asm/unistd.h> */
#include <linux/config.h>
+#include <linux/cpu.h>
#include <linux/pm.h>
#include <linux/elf.h>
#include <linux/errno.h>
@@ -14,6 +15,7 @@
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/module.h>
+#include <linux/notifier.h>
#include <linux/personality.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -22,13 +24,17 @@
#include <linux/thread_info.h>
#include <linux/unistd.h>
#include <linux/efi.h>
+#include <linux/interrupt.h>
+#include <asm/cpu.h>
#include <asm/delay.h>
#include <asm/elf.h>
#include <asm/ia32.h>
+#include <asm/irq.h>
#include <asm/pgalloc.h>
#include <asm/processor.h>
#include <asm/sal.h>
+#include <asm/tlbflush.h>
#include <asm/uaccess.h>
#include <asm/unwind.h>
#include <asm/user.h>
@@ -180,6 +186,40 @@ default_idle (void)
safe_halt();
}
+#ifdef CONFIG_HOTPLUG_CPU
+/* We don't actually take CPU down, just spin without interrupts. */
+static inline void play_dead(void)
+{
+ extern void ia64_cpu_local_tick (void);
+ /* Ack it */
+ __get_cpu_var(cpu_state) = CPU_DEAD;
+
+ /* We shouldn't have to disable interrupts while dead, but
+ * some interrupts just don't seem to go away, and this makes
+ * it "work" for testing purposes. */
+ max_xtp();
+ local_irq_disable();
+ /* Death loop */
+ while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
+ cpu_relax();
+
+ /*
+ * Enable timer interrupts from now on
+ * Not required if we put processor in SAL_BOOT_RENDEZ mode.
+ */
+ local_flush_tlb_all();
+ cpu_set(smp_processor_id(), cpu_online_map);
+ wmb();
+ ia64_cpu_local_tick ();
+ local_irq_enable();
+}
+#else
+static inline void play_dead(void)
+{
+ BUG();
+}
+#endif /* CONFIG_HOTPLUG_CPU */
+
void __attribute__((noreturn))
cpu_idle (void *unused)
{
@@ -195,7 +235,6 @@ cpu_idle (void *unused)
if (!need_resched())
min_xtp();
#endif
-
while (!need_resched()) {
if (mark_idle)
(*mark_idle)(1);
@@ -210,6 +249,8 @@ cpu_idle (void *unused)
#endif
schedule();
check_pgt_cache();
+ if (cpu_is_offline(smp_processor_id()))
+ play_dead();
}
}
diff -puN arch/ia64/kernel/smpboot.c~hotcpu_ia64 arch/ia64/kernel/smpboot.c
--- linux-2.6.6-rc3/arch/ia64/kernel/smpboot.c~hotcpu_ia64 2004-05-04 20:52:19.532660914 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/smpboot.c 2004-05-04 20:52:19.555121863 -0700
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/bootmem.h>
+#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
@@ -22,10 +23,12 @@
#include <linux/kernel.h>
#include <linux/kernel_stat.h>
#include <linux/mm.h>
+#include <linux/notifier.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <linux/efi.h>
+#include <linux/percpu.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
@@ -44,6 +47,7 @@
#include <asm/ptrace.h>
#include <asm/sal.h>
#include <asm/system.h>
+#include <asm/tlbflush.h>
#include <asm/unistd.h>
#define SMP_DEBUG 0
@@ -75,6 +79,11 @@ extern unsigned long ia64_iobase;
task_t *task_for_booting_cpu;
+/*
+ * State for each CPU
+ */
+DEFINE_PER_CPU(int, cpu_state);
+
/* Bitmasks of currently online, and possible CPUs */
cpumask_t cpu_online_map;
EXPORT_SYMBOL(cpu_online_map);
@@ -281,12 +290,16 @@ smp_callin (void)
cpuid = smp_processor_id();
phys_id = hard_smp_processor_id();
- if (cpu_test_and_set(cpuid, cpu_online_map)) {
+ if (cpu_online(cpuid)) {
printk(KERN_ERR "huh, phys CPU#0x%x, CPU#0x%x already present??\n",
phys_id, cpuid);
BUG();
}
+ lock_ipi_calllock();
+ cpu_set(cpuid, cpu_online_map);
+ unlock_ipi_calllock();
+
smp_setup_percpu_timer();
/*
@@ -357,29 +370,51 @@ fork_by_hand (void)
return copy_process(CLONE_VM|CLONE_IDLETASK, 0, 0, 0, NULL, NULL);
}
+struct create_idle {
+ struct task_struct *idle;
+ struct completion done;
+};
+
+void
+do_fork_idle(void *_c_idle)
+{
+ struct create_idle *c_idle = _c_idle;
+
+ c_idle->idle = fork_by_hand();
+ complete(&c_idle->done);
+}
+
static int __devinit
do_boot_cpu (int sapicid, int cpu)
{
- struct task_struct *idle;
int timeout;
+ struct create_idle c_idle;
+ DECLARE_WORK(work, do_fork_idle, &c_idle);
+ init_completion(&c_idle.done);
/*
* We can't use kernel_thread since we must avoid to reschedule the child.
*/
- idle = fork_by_hand();
- if (IS_ERR(idle))
+ if (!keventd_up() || current_is_keventd())
+ work.func(work.data);
+ else {
+ schedule_work(&work);
+ wait_for_completion(&c_idle.done);
+ }
+
+ if (IS_ERR(c_idle.idle))
panic("failed fork for CPU %d", cpu);
- wake_up_forked_process(idle);
+ wake_up_forked_process(c_idle.idle);
/*
* We remove it from the pidhash and the runqueue
* once we got the process:
*/
- init_idle(idle, cpu);
+ init_idle(c_idle.idle, cpu);
- unhash_process(idle);
+ unhash_process(c_idle.idle);
- task_for_booting_cpu = idle;
+ task_for_booting_cpu = c_idle.idle;
Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);
@@ -438,8 +473,12 @@ smp_build_cpu_map (void)
int sapicid, cpu, i;
int boot_cpu_id = hard_smp_processor_id();
- for (cpu = 0; cpu < NR_CPUS; cpu++)
+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
ia64_cpu_to_sapicid[cpu] = -1;
+#ifdef CONFIG_HOTPLUG_CPU
+ cpu_set(cpu, cpu_possible_map);
+#endif
+ }
ia64_cpu_to_sapicid[0] = boot_cpu_id;
cpus_clear(cpu_present_map);
@@ -546,6 +585,74 @@ void __devinit smp_prepare_boot_cpu(void
cpu_set(smp_processor_id(), cpu_callin_map);
}
+#ifdef CONFIG_HOTPLUG_CPU
+extern void fixup_irqs(void);
+/* must be called with cpucontrol mutex held */
+static int __devinit cpu_enable(unsigned int cpu)
+{
+ per_cpu(cpu_state,cpu) = CPU_UP_PREPARE;
+ wmb();
+
+ while (!cpu_online(cpu))
+ cpu_relax();
+ return 0;
+}
+
+int __cpu_disable(void)
+{
+ int cpu = smp_processor_id();
+
+ /*
+ * dont permit boot processor for now
+ */
+ if (cpu == 0)
+ return -EBUSY;
+
+ fixup_irqs();
+ local_flush_tlb_all();
+ printk ("Disabled cpu %u\n", smp_processor_id());
+ return 0;
+}
+
+void __cpu_die(unsigned int cpu)
+{
+ unsigned int i;
+
+ for (i = 0; i < 100; i++) {
+ /* They ack this in play_dead by setting CPU_DEAD */
+ if (per_cpu(cpu_state, cpu) == CPU_DEAD)
+ {
+ /*
+ * TBD: Enable this when physical removal
+ * or when we put the processor is put in
+ * SAL_BOOT_RENDEZ mode
+ * cpu_clear(cpu, cpu_callin_map);
+ */
+ return;
+ }
+ current->state = TASK_UNINTERRUPTIBLE;
+ schedule_timeout(HZ/10);
+ }
+ printk(KERN_ERR "CPU %u didn't die...\n", cpu);
+}
+#else /* !CONFIG_HOTPLUG_CPU */
+static int __devinit cpu_enable(unsigned int cpu)
+{
+ return 0;
+}
+
+int __cpu_disable(void)
+{
+ return -ENOSYS;
+}
+
+void __cpu_die(unsigned int cpu)
+{
+ /* We said "no" in __cpu_disable */
+ BUG();
+}
+#endif /* CONFIG_HOTPLUG_CPU */
+
void
smp_cpus_done (unsigned int dummy)
{
@@ -574,6 +681,17 @@ __cpu_up (unsigned int cpu)
if (sapicid == -1)
return -EINVAL;
+ /*
+ * Already booted.. just enable and get outa idle lool
+ */
+ if (cpu_isset(cpu, cpu_callin_map))
+ {
+ cpu_enable(cpu);
+ local_irq_enable();
+ while (!cpu_isset(cpu, cpu_online_map))
+ mb();
+ return 0;
+ }
/* Processor goes to start_secondary(), sets online flag */
ret = do_boot_cpu(sapicid, cpu);
if (ret < 0)
diff -puN arch/ia64/kernel/smp.c~hotcpu_ia64 arch/ia64/kernel/smp.c
--- linux-2.6.6-rc3/arch/ia64/kernel/smp.c~hotcpu_ia64 2004-05-04 20:52:19.533637477 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/smp.c 2004-05-04 20:52:19.556098426 -0700
@@ -71,10 +71,23 @@ static volatile struct call_data_struct
/* This needs to be cacheline aligned because it is written to by *other* CPUs. */
static DEFINE_PER_CPU(u64, ipi_operation) ____cacheline_aligned;
+extern void cpu_halt (void);
+
+void
+lock_ipi_calllock(void)
+{
+ spin_lock_irq(&call_lock);
+}
+
+void
+unlock_ipi_calllock(void)
+{
+ spin_unlock_irq(&call_lock);
+}
+
static void
stop_this_cpu (void)
{
- extern void cpu_halt (void);
/*
* Remove this CPU:
*/
@@ -84,6 +97,17 @@ stop_this_cpu (void)
cpu_halt();
}
+void
+cpu_die(void)
+{
+ max_xtp();
+ local_irq_disable();
+ cpu_halt();
+ /* Should never be here */
+ BUG();
+ for (;;);
+}
+
irqreturn_t
handle_IPI (int irq, void *dev_id, struct pt_regs *regs)
{
diff -puN arch/ia64/kernel/time.c~hotcpu_ia64 arch/ia64/kernel/time.c
--- linux-2.6.6-rc3/arch/ia64/kernel/time.c~hotcpu_ia64 2004-05-04 20:52:19.534614040 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/time.c 2004-05-04 20:52:19.556098426 -0700
@@ -10,6 +10,7 @@
*/
#include <linux/config.h>
+#include <linux/cpu.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -244,6 +245,10 @@ timer_interrupt (int irq, void *dev_id,
{
unsigned long new_itm;
+ if (unlikely(cpu_is_offline(smp_processor_id()))) {
+ return IRQ_HANDLED;
+ }
+
platform_timer_interrupt(irq, dev_id, regs);
new_itm = local_cpu_data->itm_next;
diff -puN include/asm-ia64/smp.h~hotcpu_ia64 include/asm-ia64/smp.h
--- linux-2.6.6-rc3/include/asm-ia64/smp.h~hotcpu_ia64 2004-05-04 20:52:19.536567166 -0700
+++ linux-2.6.6-rc3-root/include/asm-ia64/smp.h 2004-05-04 20:52:19.556098426 -0700
@@ -120,6 +120,8 @@ extern void smp_do_timer (struct pt_regs
extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
int retry, int wait);
extern void smp_send_reschedule (int cpu);
+extern void lock_ipi_calllock(void);
+extern void unlock_ipi_calllock(void);
#endif /* CONFIG_SMP */
#endif /* _ASM_IA64_SMP_H */
diff -puN arch/ia64/kernel/iosapic.c~hotcpu_ia64 arch/ia64/kernel/iosapic.c
--- linux-2.6.6-rc3/arch/ia64/kernel/iosapic.c~hotcpu_ia64 2004-05-04 20:52:19.537543729 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/iosapic.c 2004-05-04 20:52:19.557074989 -0700
@@ -32,6 +32,8 @@
* 03/02/19 B. Helgaas Make pcat_compat system-wide, not per-IOSAPIC.
* Remove iosapic_address & gsi_base from external interfaces.
* Rationalize __init/__devinit attributes.
+ * 04/12/04 Ashok Raj <ashok.raj@intel.com> Intel Corporation 2004
+ * Updated to work with irq migration necessary for CPU Hotplug
*/
/*
* Here is what the interrupt logic between a PCI device and the kernel looks like:
@@ -189,8 +191,10 @@ set_rte (unsigned int vector, unsigned i
pol = iosapic_intr_info[vector].polarity;
trigger = iosapic_intr_info[vector].trigger;
dmode = iosapic_intr_info[vector].dmode;
+ vector &= (~IA64_IRQ_REDIRECTED);
redir = (dmode == IOSAPIC_LOWEST_PRIORITY) ? 1 : 0;
+
#ifdef CONFIG_SMP
{
unsigned int irq;
@@ -312,9 +316,8 @@ iosapic_set_affinity (unsigned int irq,
spin_lock_irqsave(&iosapic_lock, flags);
{
- /* get current delivery mode by reading the low32 */
- writel(IOSAPIC_RTE_LOW(rte_index), addr + IOSAPIC_REG_SELECT);
low32 = iosapic_intr_info[vec].low32 & ~(7 << IOSAPIC_DELIVERY_SHIFT);
+
if (redir)
/* change delivery mode to lowest priority */
low32 |= (IOSAPIC_LOWEST_PRIORITY << IOSAPIC_DELIVERY_SHIFT);
diff -puN arch/ia64/kernel/irq_ia64.c~hotcpu_ia64 arch/ia64/kernel/irq_ia64.c
--- linux-2.6.6-rc3/arch/ia64/kernel/irq_ia64.c~hotcpu_ia64 2004-05-04 20:52:19.550239048 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/irq_ia64.c 2004-05-04 20:52:19.557074989 -0700
@@ -10,6 +10,8 @@
*
* 09/15/00 Goutham Rao <goutham.rao@intel.com> Implemented pci_irq_to_vector
* PCI to vector allocation routine.
+ * 04/14/2004 Ashok Raj <ashok.raj@intel.com>
+ * Added CPU Hotplug handling for IPF.
*/
#include <linux/config.h>
@@ -85,6 +87,11 @@ assign_irq_vector (int irq)
extern unsigned int do_IRQ(unsigned long irq, struct pt_regs *regs);
+#ifdef CONFIG_SMP
+# define IS_RESCHEDULE(vec) (vec == IA64_IPI_RESCHEDULE)
+#else
+# define IS_RESCHEDULE(vec) (0)
+#endif
/*
* That's where the IVT branches when we get an external
* interrupt. This branches to the correct hardware IRQ handler via
@@ -94,11 +101,6 @@ void
ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
{
unsigned long saved_tpr;
-#ifdef CONFIG_SMP
-# define IS_RESCHEDULE(vec) (vec == IA64_IPI_RESCHEDULE)
-#else
-# define IS_RESCHEDULE(vec) (0)
-#endif
#if IRQ_DEBUG
{
@@ -162,6 +164,54 @@ ia64_handle_irq (ia64_vector vector, str
irq_exit();
}
+#ifdef CONFIG_HOTPLUG_CPU
+/*
+ * This function emulates a interrupt processing when a cpu is about to be
+ * brought down.
+ */
+void ia64_process_pending_intr(void)
+{
+ ia64_vector vector;
+ unsigned long saved_tpr;
+ extern unsigned int vectors_in_migration[NR_IRQS];
+
+ vector = ia64_get_ivr();
+
+ irq_enter();
+ saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
+ ia64_srlz_d();
+
+ /*
+ * Perform normal interrupt style processing
+ */
+ while (vector != IA64_SPURIOUS_INT_VECTOR) {
+ if (!IS_RESCHEDULE(vector)) {
+ ia64_setreg(_IA64_REG_CR_TPR, vector);
+ ia64_srlz_d();
+
+ /*
+ * Now try calling normal ia64_handle_irq as it would have got called
+ * from a real intr handler. Try passing null for pt_regs, hopefully
+ * it will work. I hope it works!.
+ * Probably could shared code.
+ */
+ vectors_in_migration[local_vector_to_irq(vector)]=0;
+ do_IRQ(local_vector_to_irq(vector), NULL);
+
+ /*
+ * Disable interrupts and send EOI
+ */
+ local_irq_disable();
+ ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
+ }
+ ia64_eoi();
+ vector = ia64_get_ivr();
+ }
+ irq_exit();
+}
+#endif
+
+
#ifdef CONFIG_SMP
extern irqreturn_t handle_IPI (int irq, void *dev_id, struct pt_regs *regs);
diff -puN arch/ia64/kernel/sal.c~hotcpu_ia64 arch/ia64/kernel/sal.c
--- linux-2.6.6-rc3/arch/ia64/kernel/sal.c~hotcpu_ia64 2004-05-04 20:52:19.551215611 -0700
+++ linux-2.6.6-rc3-root/arch/ia64/kernel/sal.c 2004-05-04 20:52:19.557074989 -0700
@@ -122,10 +122,23 @@ sal_desc_entry_point (void *p)
static void __init
set_smp_redirect (int flag)
{
+#ifndef CONFIG_HOTPLUG_CPU
if (no_int_routing)
smp_int_redirect &= ~flag;
else
smp_int_redirect |= flag;
+#else
+ /*
+ * For CPU Hotplug we dont want to do any chipset supported
+ * interrupt redirection. The reason is this would require that
+ * All interrupts be stopped and hard bind the irq to a cpu.
+ * Later when the interrupt is fired we need to set the redir hint
+ * on again in the vector. This is combersome for something that the
+ * user mode irq balancer will solve anyways.
+ */
+ no_int_routing=1;
+ smp_int_redirect &= ~flag;
+#endif
}
#else
#define set_smp_redirect(flag) do { } while (0)
_
-
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/
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 4/15] pj-fix-4-include-mempolicy
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (2 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 3/15] pj-fix-3-ashoks-updated-cpuhotplug-7-7 Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 5/15] pj-fix-5-syscall-return-semicolon Paul Jackson
` (11 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
Fix numa build - small-numa-api-fixups.patch replaced
an included with a struct forward declaration, so now
some other files need to include mempolicy.h explicitly.
--- 2.6.6-rc3-mm2-old/arch/ia64/ia32/binfmt_elf32.c 2004-05-06 03:57:09.000000000 -0700
+++ 2.6.6-rc3-mm2/arch/ia64/ia32/binfmt_elf32.c 2004-05-05 11:54:15.000000000 -0700
@@ -13,6 +13,7 @@
#include <linux/types.h>
#include <linux/mm.h>
+#include <linux/mempolicy.h>
#include <linux/security.h>
#include <asm/param.h>
--- 2.6.6-rc3-mm2-old/arch/ia64/kernel/perfmon.c 2004-05-06 03:57:09.000000000 -0700
+++ 2.6.6-rc3-mm2/arch/ia64/kernel/perfmon.c 2004-05-05 11:54:15.000000000 -0700
@@ -29,6 +29,7 @@
#include <linux/init.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
+#include <linux/mempolicy.h>
#include <linux/sysctl.h>
#include <linux/list.h>
#include <linux/file.h>
--- 2.6.6-rc3-mm2-old/arch/ia64/mm/init.c 2004-05-06 03:57:36.000000000 -0700
+++ 2.6.6-rc3-mm2/arch/ia64/mm/init.c 2004-05-05 11:54:39.000000000 -0700
@@ -12,6 +12,7 @@
#include <linux/efi.h>
#include <linux/elf.h>
#include <linux/mm.h>
+#include <linux/mempolicy.h>
#include <linux/mmzone.h>
#include <linux/module.h>
#include <linux/personality.h>
--- 2.6.6-rc3-mm2-old/kernel/exit.c 2004-05-06 03:57:09.000000000 -0700
+++ 2.6.6-rc3-mm2/kernel/exit.c 2004-05-05 11:54:16.000000000 -0700
@@ -6,6 +6,7 @@
#include <linux/config.h>
#include <linux/mm.h>
+#include <linux/mempolicy.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/smp_lock.h>
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 5/15] pj-fix-5-syscall-return-semicolon
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (3 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 4/15] pj-fix-4-include-mempolicy Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 6/15] nonsmp-cpu-present-map Paul Jackson
` (10 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
Changes to system call return value were missing a semi-colon.
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-sparc/unistd.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-sparc/unistd.h 2004-05-06 03:57:38.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-sparc/unistd.h 2004-05-06 04:37:39.000000000 -0700
@@ -325,7 +325,7 @@
: "=r" (__res)\
: "r" (__g1) \
: "o0", "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall1(type,name,type1,arg1) \
@@ -342,7 +342,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall2(type,name,type1,arg1,type2,arg2) \
@@ -360,7 +360,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
@@ -379,7 +379,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
@@ -399,7 +399,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
@@ -421,7 +421,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#ifdef __KERNEL_SYSCALLS__
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-sparc64/unistd.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-sparc64/unistd.h 2004-05-06 03:57:38.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-sparc64/unistd.h 2004-05-06 04:37:39.000000000 -0700
@@ -324,7 +324,7 @@
: "=r" (__res)\
: "r" (__g1) \
: "o0", "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall1(type,name,type1,arg1) \
@@ -339,7 +339,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall2(type,name,type1,arg1,type2,arg2) \
@@ -355,7 +355,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
@@ -372,7 +372,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
@@ -390,7 +390,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
@@ -410,7 +410,7 @@
: "=r" (__res), "=&r" (__o0) \
: "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
: "cc"); \
- __syscall_return(type, __res) \
+ __syscall_return(type, __res); \
}
#ifdef __KERNEL_SYSCALLS__
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-mips/unistd.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-mips/unistd.h 2004-05-06 03:57:38.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-mips/unistd.h 2004-05-06 04:39:10.000000000 -0700
@@ -847,7 +847,7 @@
: "i" (__NR_##name) \
: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
/*
@@ -871,7 +871,7 @@
: "r" (__a0), "i" (__NR_##name) \
: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#define _syscall2(type,name,atype,a,btype,b) \
@@ -892,7 +892,7 @@
: "r" (__a0), "r" (__a1), "i" (__NR_##name) \
: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
@@ -914,7 +914,7 @@
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
@@ -936,7 +936,7 @@
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
@@ -969,7 +969,7 @@
"m" ((unsigned long)e) \
: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
@@ -998,7 +998,7 @@
"m" ((unsigned long)e), "m" ((unsigned long)f) \
: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#endif /* (_MIPS_SIM == _MIPS_SIM_ABI32) */
@@ -1025,7 +1025,7 @@
: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
: "$2","$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
@@ -1050,7 +1050,7 @@
"i" (__NR_##name) \
: "$2","$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \
\
- __syscall_return(type, __v0) \
+ __syscall_return(type, __v0); \
}
#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 6/15] nonsmp-cpu-present-map
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (4 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 5/15] pj-fix-5-syscall-return-semicolon Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 7/15] mask1-bitmap-cleanup-prep Paul Jackson
` (9 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
Fix build breakage if CONFIG_SMP disabled, in Ashok's cpuhotplog
patches in init/main.c routine fixup_cpu_present_map().
Make cpu_present_map a real map for all configurations,
instead of a constant for non-SMP. Also move 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.
============= include/linux/cpumask.h =============
--- 2.6.6-rc3-mm2-old/include/linux/cpumask.h 2004-05-06 04:22:43.000000000 -0700
+++ 2.6.6-rc3-mm2/include/linux/cpumask.h 2004-05-06 03:30:32.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 @@ extern cpumask_t cpu_present_map;
#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)
============= kernel/cpu.c =============
--- 2.6.6-rc3-mm2-old/kernel/cpu.c 2004-05-06 04:22:43.000000000 -0700
+++ 2.6.6-rc3-mm2/kernel/cpu.c 2004-05-06 01:07:27.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)
============= kernel/sched.c =============
--- 2.6.6-rc3-mm2-old/kernel/sched.c 2004-05-06 04:22:43.000000000 -0700
+++ 2.6.6-rc3-mm2/kernel/sched.c 2004-05-06 03:30:35.000000000 -0700
@@ -3052,6 +3052,16 @@ out_unlock:
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_setaffinity - set 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
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 7/15] mask1-bitmap-cleanup-prep
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (5 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 6/15] nonsmp-cpu-present-map Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 8/15] mask2-bitmap-extensions Paul Jackson
` (8 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask1-bitmap-cleanup-prep
Document the bitmap bit model and handling of unused bits.
Tighten up bitmap so it does not generate nonzero bits
in the unused tail if it is not given any on input.
Add intersects, subset, xor and andnot operators.
Change bitmap_complement to take two operands.
Add a couple of missing 'const' qualifiers on
bitops test_bit and bitmap_equal args.
Index: 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/smpboot.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/x86_64/kernel/smpboot.c 2004-05-05 08:07:06.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/smpboot.c 2004-05-05 08:08:57.000000000 -0700
@@ -827,7 +827,7 @@
if (apicid == boot_cpu_id || (apicid == BAD_APICID))
continue;
- if (!cpu_isset(apicid, phys_cpu_present_map))
+ if (!physid_isset(apicid, phys_cpu_present_map))
continue;
if ((max_cpus >= 0) && (max_cpus <= cpucount+1))
continue;
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-generic/bitops.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-generic/bitops.h 2004-05-05 08:07:06.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-generic/bitops.h 2004-05-05 08:08:57.000000000 -0700
@@ -42,7 +42,7 @@
return retval;
}
-extern __inline__ int test_bit(int nr, long * addr)
+extern __inline__ int test_bit(int nr, const unsigned long * addr)
{
int mask;
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-generic/cpumask_array.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-generic/cpumask_array.h 2004-05-05 08:07:06.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-generic/cpumask_array.h 2004-05-05 08:08:57.000000000 -0700
@@ -17,7 +17,7 @@
#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)
#define cpus_clear(map) bitmap_zero((map).mask, NR_CPUS)
-#define cpus_complement(map) bitmap_complement((map).mask, NR_CPUS)
+#define cpus_complement(map) bitmap_complement((map).mask, (map).mask, NR_CPUS)
#define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
#define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS)
#define cpus_addr(map) ((map).mask)
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mpspec.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mpspec.h 2004-05-05 08:07:06.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mpspec.h 2004-05-05 08:08:57.000000000 -0700
@@ -53,7 +53,7 @@
#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
-#define physids_complement(map) bitmap_complement((map).mask, MAX_APICS)
+#define physids_complement(map) bitmap_complement((map).mask, (map).mask, MAX_APICS)
#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/mpspec.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-x86_64/mpspec.h 2004-05-05 08:07:06.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/mpspec.h 2004-05-05 08:08:57.000000000 -0700
@@ -212,7 +212,7 @@
#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
-#define physids_complement(map) bitmap_complement((map).mask, MAX_APICS)
+#define physids_complement(map) bitmap_complement((map).mask, (map).mask, MAX_APICS)
#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
Index: 2.6.6-rc3-mm2-bitmapv5/include/linux/bitmap.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/linux/bitmap.h 2004-05-05 08:07:06.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/linux/bitmap.h 2004-05-05 08:08:57.000000000 -0700
@@ -13,8 +13,8 @@
int bitmap_empty(const unsigned long *bitmap, int bits);
int bitmap_full(const unsigned long *bitmap, int bits);
int bitmap_equal(const unsigned long *bitmap1,
- unsigned long *bitmap2, int bits);
-void bitmap_complement(unsigned long *bitmap, int bits);
+ const unsigned long *bitmap2, int bits);
+void bitmap_complement(unsigned long *dst, const unsigned long *src, int bits);
static inline void bitmap_zero(unsigned long *bitmap, int bits)
{
@@ -41,6 +41,14 @@
const unsigned long *bitmap2, int bits);
void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
+void bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+void bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+int bitmap_intersects(const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+int bitmap_subset(const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
int bitmap_weight(const unsigned long *bitmap, int bits);
int bitmap_scnprintf(char *buf, unsigned int buflen,
const unsigned long *maskp, int bits);
Index: 2.6.6-rc3-mm2-bitmapv5/lib/bitmap.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/lib/bitmap.c 2004-05-05 08:07:06.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/lib/bitmap.c 2004-05-05 08:08:57.000000000 -0700
@@ -12,6 +12,26 @@
#include <asm/bitops.h>
#include <asm/uaccess.h>
+/*
+ * bitmaps provide an array of bits, implemented using an an
+ * array of unsigned longs. The number of valid bits in a
+ * given bitmap need not be an exact multiple of BITS_PER_LONG.
+ *
+ * The possible unused bits in the last, partially used word
+ * of a bitmap are 'don't care'. The implementation makes
+ * no particular effort to keep them zero. It ensures that
+ * their value will not affect the results of any operation.
+ * The bitmap operations that return Boolean (bitmap_empty,
+ * for example) or scalar (bitmap_weight, for example) results
+ * carefully filter out these unused bits from impacting their
+ * results.
+ *
+ * These operations actually hold to a slightly stronger rule:
+ * if you don't input any bitmaps to these ops that have some
+ * unused bits set, then they won't output any set unused bits
+ * in output bitmaps.
+ */
+
int bitmap_empty(const unsigned long *bitmap, int bits)
{
int k, lim = bits/BITS_PER_LONG;
@@ -43,7 +63,7 @@
EXPORT_SYMBOL(bitmap_full);
int bitmap_equal(const unsigned long *bitmap1,
- unsigned long *bitmap2, int bits)
+ const unsigned long *bitmap2, int bits)
{
int k, lim = bits/BITS_PER_LONG;
for (k = 0; k < lim; ++k)
@@ -59,13 +79,14 @@
}
EXPORT_SYMBOL(bitmap_equal);
-void bitmap_complement(unsigned long *bitmap, int bits)
+void bitmap_complement(unsigned long *dst, const unsigned long *src, int bits)
{
- int k;
- int nr = BITS_TO_LONGS(bits);
+ int k, lim = bits/BITS_PER_LONG;
+ for (k = 0; k < lim; ++k)
+ dst[k] = ~src[k];
- for (k = 0; k < nr; ++k)
- bitmap[k] = ~bitmap[k];
+ if (bits % BITS_PER_LONG)
+ dst[k] = ~src[k] & ((1UL << (bits % BITS_PER_LONG)) - 1);
}
EXPORT_SYMBOL(bitmap_complement);
@@ -173,6 +194,60 @@
}
EXPORT_SYMBOL(bitmap_or);
+void bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits)
+{
+ int k;
+ int nr = BITS_TO_LONGS(bits);
+
+ for (k = 0; k < nr; k++)
+ dst[k] = bitmap1[k] ^ bitmap2[k];
+}
+EXPORT_SYMBOL(bitmap_xor);
+
+void bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits)
+{
+ int k;
+ int nr = BITS_TO_LONGS(bits);
+
+ for (k = 0; k < nr; k++)
+ dst[k] = bitmap1[k] & ~bitmap2[k];
+}
+EXPORT_SYMBOL(bitmap_andnot);
+
+int bitmap_intersects(const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits)
+{
+ int k, lim = bits/BITS_PER_LONG;
+ for (k = 0; k < lim; ++k)
+ if (bitmap1[k] & bitmap2[k])
+ return 1;
+
+ if (bits % BITS_PER_LONG)
+ if ((bitmap1[k] & bitmap2[k]) &
+ ((1UL << (bits % BITS_PER_LONG)) - 1))
+ return 1;
+ return 0;
+}
+EXPORT_SYMBOL(bitmap_intersects);
+
+int bitmap_subset(const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits)
+{
+ int k, lim = bits/BITS_PER_LONG;
+ for (k = 0; k < lim; ++k)
+ if (bitmap1[k] & ~bitmap2[k])
+ return 0;
+
+ if (bits % BITS_PER_LONG)
+ if ((bitmap1[k] & ~bitmap2[k]) &
+ ((1UL << (bits % BITS_PER_LONG)) - 1))
+ return 0;
+ return 1;
+}
+EXPORT_SYMBOL(bitmap_subset);
+
#if BITS_PER_LONG == 32
int bitmap_weight(const unsigned long *bitmap, int bits)
{
Index: 2.6.6-rc3-mm2-bitmapv5/mm/mempolicy.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/mm/mempolicy.c 2004-05-05 08:08:43.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/mm/mempolicy.c 2004-05-05 08:09:40.000000000 -0700
@@ -92,14 +92,12 @@
/* Check if all specified nodes are online */
static int nodes_online(unsigned long *nodes)
{
- DECLARE_BITMAP(offline, MAX_NUMNODES);
+ DECLARE_BITMAP(online2, MAX_NUMNODES);
- bitmap_copy(offline, node_online_map, MAX_NUMNODES);
- if (bitmap_empty(offline, MAX_NUMNODES))
- set_bit(0, offline);
- bitmap_complement(offline, MAX_NUMNODES);
- bitmap_and(offline, offline, nodes, MAX_NUMNODES);
- if (!bitmap_empty(offline, MAX_NUMNODES))
+ bitmap_copy(online2, node_online_map, MAX_NUMNODES);
+ if (bitmap_empty(online2, MAX_NUMNODES))
+ set_bit(0, online2);
+ if (!bitmap_subset(nodes, online2, MAX_NUMNODES))
return -EINVAL;
return 0;
}
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 8/15] mask2-bitmap-extensions
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (6 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 7/15] mask1-bitmap-cleanup-prep Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 9/15] mask3-unline-find-next-bit-ia64 Paul Jackson
` (7 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask2-bitmap-extensions
This bitmap improvements make it a suitable basis for
fully supporting cpumask_t and nodemask_t. Inline macros
with compile-time checks enable generating tight code on
both small and large systems (large meaning cpumask_t
requires more than one unsigned long's worth of bits).
The existing bitmap_<op> macros in lib/bitmap.c
are renamed to __bitmap_<op>, and wrappers for each
bitmap_<op> are exposed in include/linux/bitmap.h
This patch _includes_ Bill Irwins rewrite of the
bitmap_shift operators to not require a fixed length
intermediate bitmap.
Improved comments list each available operator for easy
browsing.
Index: 2.6.6-rc3-mm1-bitmapv5/include/linux/bitmap.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/linux/bitmap.h 2004-05-05 02:28:23.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/linux/bitmap.h 2004-05-05 02:36:26.000000000 -0700
@@ -3,57 +3,249 @@
#ifndef __ASSEMBLY__
-#include <linux/config.h>
-#include <linux/compiler.h>
#include <linux/types.h>
-#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/string.h>
-int bitmap_empty(const unsigned long *bitmap, int bits);
-int bitmap_full(const unsigned long *bitmap, int bits);
-int bitmap_equal(const unsigned long *bitmap1,
- const unsigned long *bitmap2, int bits);
-void bitmap_complement(unsigned long *dst, const unsigned long *src, int bits);
+/*
+ * bitmaps provide bit arrays that consume one or more unsigned
+ * longs. The bitmap interface and available operations are listed
+ * here, in bitmap.h
+ *
+ * Function implementations generic to all architectures are in
+ * lib/bitmap.c. Functions implementations that are architecture
+ * specific are in various include/asm-<arch>/bitops.h headers
+ * and other arch/<arch> specific files.
+ *
+ * See lib/bitmap.c for more details.
+ */
+
+/*
+ * The available bitmap operations and their rough meaning in the
+ * case that the bitmap is a single unsigned long are thus:
+ *
+ * bitmap_zero(dst, nbits) *dst = 0UL
+ * bitmap_fill(dst, nbits) *dst = ~0UL
+ * bitmap_copy(dst, src, nbits) *dst = *src
+ * bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2
+ * bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2
+ * bitmap_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2
+ * bitmap_andnot(dst, src1, src2, nbits) *dst = *src1 & ~(*src2)
+ * bitmap_complement(dst, src, nbits) *dst = ~(*src)
+ * bitmap_equal(src1, src2, nbits) Are *src1 and *src2 equal?
+ * bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap?
+ * bitmap_subset(src1, src2, nbits) Is *src1 a subset of *src2?
+ * bitmap_empty(src, nbits) Are all bits zero in *src?
+ * bitmap_full(src, nbits) Are all bits set in *src?
+ * bitmap_weight(src, nbits) Hamming Weight: number set bits
+ * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
+ * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
+ * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
+ * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from buf
+ */
+
+/*
+ * Also the following operations in asm/bitops.h apply to bitmaps.
+ *
+ * set_bit(bit, addr) *addr |= bit
+ * clear_bit(bit, addr) *addr &= ~bit
+ * change_bit(bit, addr) *addr ^= bit
+ * test_bit(bit, addr) Is bit set in *addr?
+ * test_and_set_bit(bit, addr) Set bit and return old value
+ * test_and_clear_bit(bit, addr) Clear bit and return old value
+ * test_and_change_bit(bit, addr) Change bit and return old value
+ * find_first_zero_bit(addr, nbits) Position first zero bit in *addr
+ * find_first_bit(addr, nbits) Position first set bit in *addr
+ * find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit
+ * find_next_bit(addr, nbits, bit) Position next set bit in *addr >= bit
+ */
+
+/*
+ * The DECLARE_BITMAP(name,bits) macro, in linux/types.h, can be used
+ * to declare an array named 'name' of just enough unsigned longs to
+ * contain all bit positions from 0 to 'bits' - 1.
+ */
+
+/*
+ * lib/bitmap.c provides these functions:
+ */
+
+extern int __bitmap_empty(const unsigned long *bitmap, int bits);
+extern int __bitmap_full(const unsigned long *bitmap, int bits);
+extern int __bitmap_equal(const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
+ int bits);
+extern void __bitmap_shift_right(unsigned long *dst,
+ const unsigned long *src, int shift, int bits);
+extern void __bitmap_shift_left(unsigned long *dst,
+ const unsigned long *src, int shift, int bits);
+extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+extern int __bitmap_intersects(const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+extern int __bitmap_subset(const unsigned long *bitmap1,
+ const unsigned long *bitmap2, int bits);
+extern int __bitmap_weight(const unsigned long *bitmap, int bits);
+
+extern int bitmap_scnprintf(char *buf, unsigned int len,
+ const unsigned long *src, int nbits);
+extern int bitmap_parse(const char __user *ubuf, unsigned int ulen,
+ unsigned long *dst, int nbits);
+
+#define BITMAP_LAST_WORD_MASK(nbits) \
+( \
+ ((nbits) % BITS_PER_LONG) ? \
+ (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
+)
-static inline void bitmap_zero(unsigned long *bitmap, int bits)
+static inline void bitmap_zero(unsigned long *dst, int nbits)
{
- memset(bitmap, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long));
+ if (nbits <= BITS_PER_LONG)
+ *dst = 0UL;
+ else {
+ int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
+ memset(dst, 0, len);
+ }
}
-static inline void bitmap_fill(unsigned long *bitmap, int bits)
+static inline void bitmap_fill(unsigned long *dst, int nbits)
{
- memset(bitmap, 0xff, BITS_TO_LONGS(bits)*sizeof(unsigned long));
+ size_t nlongs = BITS_TO_LONGS(nbits);
+ if (nlongs > 1) {
+ int len = (nlongs - 1) * sizeof(unsigned long);
+ memset(dst, 0xff, len);
+ }
+ dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
}
-static inline void bitmap_copy(unsigned long *dst,
- const unsigned long *src, int bits)
+static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
+ int nbits)
{
- int len = BITS_TO_LONGS(bits)*sizeof(unsigned long);
- memcpy(dst, src, len);
+ if (nbits <= BITS_PER_LONG)
+ *dst = *src;
+ else {
+ int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
+ memcpy(dst, src, len);
+ }
}
-void bitmap_shift_right(unsigned long *dst,
- const unsigned long *src, int shift, int bits);
-void bitmap_shift_left(unsigned long *dst,
- const unsigned long *src, int shift, int bits);
-void bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
- const unsigned long *bitmap2, int bits);
-void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
- const unsigned long *bitmap2, int bits);
-void bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
- const unsigned long *bitmap2, int bits);
-void bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
- const unsigned long *bitmap2, int bits);
-int bitmap_intersects(const unsigned long *bitmap1,
- const unsigned long *bitmap2, int bits);
-int bitmap_subset(const unsigned long *bitmap1,
- const unsigned long *bitmap2, int bits);
-int bitmap_weight(const unsigned long *bitmap, int bits);
-int bitmap_scnprintf(char *buf, unsigned int buflen,
- const unsigned long *maskp, int bits);
-int bitmap_parse(const char __user *ubuf, unsigned int ubuflen,
- unsigned long *maskp, int bits);
+static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ *dst = *src1 & *src2;
+ else
+ __bitmap_and(dst, src1, src2, nbits);
+}
+
+static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ *dst = *src1 | *src2;
+ else
+ __bitmap_or(dst, src1, src2, nbits);
+}
+
+static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ *dst = *src1 ^ *src2;
+ else
+ __bitmap_xor(dst, src1, src2, nbits);
+}
+
+static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ *dst = *src1 & ~(*src2);
+ else
+ __bitmap_andnot(dst, src1, src2, nbits);
+}
+
+static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
+ int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits);
+ else
+ __bitmap_complement(dst, src, nbits);
+}
+
+static inline int bitmap_equal(const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
+ else
+ return __bitmap_equal(src1, src2, nbits);
+}
+
+static inline int bitmap_intersects(const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
+ else
+ return __bitmap_intersects(src1, src2, nbits);
+}
+
+static inline int bitmap_subset(const unsigned long *src1,
+ const unsigned long *src2, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
+ else
+ return __bitmap_subset(src1, src2, nbits);
+}
+
+static inline int bitmap_empty(const unsigned long *src, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
+ else
+ return __bitmap_empty(src, nbits);
+}
+
+static inline int bitmap_full(const unsigned long *src, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
+ else
+ return __bitmap_full(src, nbits);
+}
+
+static inline int bitmap_weight(const unsigned long *src, int nbits)
+{
+ return __bitmap_weight(src, nbits);
+}
+
+static inline void bitmap_shift_right(unsigned long *dst,
+ const unsigned long *src, int n, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ *dst = *src >> n;
+ else
+ __bitmap_shift_right(dst, src, n, nbits);
+}
+
+static inline void bitmap_shift_left(unsigned long *dst,
+ const unsigned long *src, int n, int nbits)
+{
+ if (nbits <= BITS_PER_LONG)
+ *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits);
+ else
+ __bitmap_shift_left(dst, src, n, nbits);
+}
#endif /* __ASSEMBLY__ */
Index: 2.6.6-rc3-mm1-bitmapv5/lib/bitmap.c
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/lib/bitmap.c 2004-05-05 02:28:25.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/lib/bitmap.c 2004-05-05 02:36:26.000000000 -0700
@@ -15,7 +15,8 @@
/*
* bitmaps provide an array of bits, implemented using an an
* array of unsigned longs. The number of valid bits in a
- * given bitmap need not be an exact multiple of BITS_PER_LONG.
+ * given bitmap does _not_ need to be an exact multiple of
+ * BITS_PER_LONG.
*
* The possible unused bits in the last, partially used word
* of a bitmap are 'don't care'. The implementation makes
@@ -30,9 +31,14 @@
* if you don't input any bitmaps to these ops that have some
* unused bits set, then they won't output any set unused bits
* in output bitmaps.
+ *
+ * The byte ordering of bitmaps is more natural on little
+ * endian architectures. See the big-endian headers
+ * include/asm-ppc64/bitops.h and include/asm-s390/bitops.h
+ * for the best explanations of this ordering.
*/
-int bitmap_empty(const unsigned long *bitmap, int bits)
+int __bitmap_empty(const unsigned long *bitmap, int bits)
{
int k, lim = bits/BITS_PER_LONG;
for (k = 0; k < lim; ++k)
@@ -40,14 +46,14 @@
return 0;
if (bits % BITS_PER_LONG)
- if (bitmap[k] & ((1UL << (bits % BITS_PER_LONG)) - 1))
+ if (bitmap[k] & BITMAP_LAST_WORD_MASK(bits))
return 0;
return 1;
}
-EXPORT_SYMBOL(bitmap_empty);
+EXPORT_SYMBOL(__bitmap_empty);
-int bitmap_full(const unsigned long *bitmap, int bits)
+int __bitmap_full(const unsigned long *bitmap, int bits)
{
int k, lim = bits/BITS_PER_LONG;
for (k = 0; k < lim; ++k)
@@ -55,14 +61,14 @@
return 0;
if (bits % BITS_PER_LONG)
- if (~bitmap[k] & ((1UL << (bits % BITS_PER_LONG)) - 1))
+ if (~bitmap[k] & BITMAP_LAST_WORD_MASK(bits))
return 0;
return 1;
}
-EXPORT_SYMBOL(bitmap_full);
+EXPORT_SYMBOL(__bitmap_full);
-int bitmap_equal(const unsigned long *bitmap1,
+int __bitmap_equal(const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits)
{
int k, lim = bits/BITS_PER_LONG;
@@ -71,27 +77,26 @@
return 0;
if (bits % BITS_PER_LONG)
- if ((bitmap1[k] ^ bitmap2[k]) &
- ((1UL << (bits % BITS_PER_LONG)) - 1))
+ if ((bitmap1[k] ^ bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits))
return 0;
return 1;
}
-EXPORT_SYMBOL(bitmap_equal);
+EXPORT_SYMBOL(__bitmap_equal);
-void bitmap_complement(unsigned long *dst, const unsigned long *src, int bits)
+void __bitmap_complement(unsigned long *dst, const unsigned long *src, int bits)
{
int k, lim = bits/BITS_PER_LONG;
for (k = 0; k < lim; ++k)
dst[k] = ~src[k];
if (bits % BITS_PER_LONG)
- dst[k] = ~src[k] & ((1UL << (bits % BITS_PER_LONG)) - 1);
+ dst[k] = ~src[k] & BITMAP_LAST_WORD_MASK(bits);
}
-EXPORT_SYMBOL(bitmap_complement);
+EXPORT_SYMBOL(__bitmap_complement);
/*
- * bitmap_shift_right - logical right shift of the bits in a bitmap
+ * __bitmap_shift_right - logical right shift of the bits in a bitmap
* @dst - destination bitmap
* @src - source bitmap
* @nbits - shift by this many bits
@@ -101,7 +106,7 @@
* direction. Zeros are fed into the vacated MS positions and the
* LS bits shifted off the bottom are lost.
*/
-void bitmap_shift_right(unsigned long *dst,
+void __bitmap_shift_right(unsigned long *dst,
const unsigned long *src, int shift, int bits)
{
int k, lim = BITS_TO_LONGS(bits), left = bits % BITS_PER_LONG;
@@ -131,10 +136,11 @@
if (off)
memset(&dst[lim - off], 0, off*sizeof(unsigned long));
}
-EXPORT_SYMBOL(bitmap_shift_right);
+EXPORT_SYMBOL(__bitmap_shift_right);
+
/*
- * bitmap_shift_left - logical left shift of the bits in a bitmap
+ * __bitmap_shift_left - logical left shift of the bits in a bitmap
* @dst - destination bitmap
* @src - source bitmap
* @nbits - shift by this many bits
@@ -144,7 +150,8 @@
* direction. Zeros are fed into the vacated LS bit positions
* and those MS bits shifted off the top are lost.
*/
-void bitmap_shift_left(unsigned long *dst,
+
+void __bitmap_shift_left(unsigned long *dst,
const unsigned long *src, int shift, int bits)
{
int k, lim = BITS_TO_LONGS(bits), left = bits % BITS_PER_LONG;
@@ -170,9 +177,9 @@
if (off)
memset(dst, 0, off*sizeof(unsigned long));
}
-EXPORT_SYMBOL(bitmap_shift_left);
+EXPORT_SYMBOL(__bitmap_shift_left);
-void bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
+void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits)
{
int k;
@@ -181,9 +188,9 @@
for (k = 0; k < nr; k++)
dst[k] = bitmap1[k] & bitmap2[k];
}
-EXPORT_SYMBOL(bitmap_and);
+EXPORT_SYMBOL(__bitmap_and);
-void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
+void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits)
{
int k;
@@ -192,9 +199,9 @@
for (k = 0; k < nr; k++)
dst[k] = bitmap1[k] | bitmap2[k];
}
-EXPORT_SYMBOL(bitmap_or);
+EXPORT_SYMBOL(__bitmap_or);
-void bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
+void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits)
{
int k;
@@ -203,9 +210,9 @@
for (k = 0; k < nr; k++)
dst[k] = bitmap1[k] ^ bitmap2[k];
}
-EXPORT_SYMBOL(bitmap_xor);
+EXPORT_SYMBOL(__bitmap_xor);
-void bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
+void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits)
{
int k;
@@ -214,9 +221,9 @@
for (k = 0; k < nr; k++)
dst[k] = bitmap1[k] & ~bitmap2[k];
}
-EXPORT_SYMBOL(bitmap_andnot);
+EXPORT_SYMBOL(__bitmap_andnot);
-int bitmap_intersects(const unsigned long *bitmap1,
+int __bitmap_intersects(const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits)
{
int k, lim = bits/BITS_PER_LONG;
@@ -225,14 +232,13 @@
return 1;
if (bits % BITS_PER_LONG)
- if ((bitmap1[k] & bitmap2[k]) &
- ((1UL << (bits % BITS_PER_LONG)) - 1))
+ if ((bitmap1[k] & bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits))
return 1;
return 0;
}
-EXPORT_SYMBOL(bitmap_intersects);
+EXPORT_SYMBOL(__bitmap_intersects);
-int bitmap_subset(const unsigned long *bitmap1,
+int __bitmap_subset(const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits)
{
int k, lim = bits/BITS_PER_LONG;
@@ -241,15 +247,14 @@
return 0;
if (bits % BITS_PER_LONG)
- if ((bitmap1[k] & ~bitmap2[k]) &
- ((1UL << (bits % BITS_PER_LONG)) - 1))
+ if ((bitmap1[k] & ~bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits))
return 0;
return 1;
}
-EXPORT_SYMBOL(bitmap_subset);
+EXPORT_SYMBOL(__bitmap_subset);
#if BITS_PER_LONG == 32
-int bitmap_weight(const unsigned long *bitmap, int bits)
+int __bitmap_weight(const unsigned long *bitmap, int bits)
{
int k, w = 0, lim = bits/BITS_PER_LONG;
@@ -257,13 +262,12 @@
w += hweight32(bitmap[k]);
if (bits % BITS_PER_LONG)
- w += hweight32(bitmap[k] &
- ((1UL << (bits % BITS_PER_LONG)) - 1));
+ w += hweight32(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
return w;
}
#else
-int bitmap_weight(const unsigned long *bitmap, int bits)
+int __bitmap_weight(const unsigned long *bitmap, int bits)
{
int k, w = 0, lim = bits/BITS_PER_LONG;
@@ -271,13 +275,12 @@
w += hweight64(bitmap[k]);
if (bits % BITS_PER_LONG)
- w += hweight64(bitmap[k] &
- ((1UL << (bits % BITS_PER_LONG)) - 1));
+ w += hweight64(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
return w;
}
#endif
-EXPORT_SYMBOL(bitmap_weight);
+EXPORT_SYMBOL(__bitmap_weight);
/*
* Bitmap printing & parsing functions: first version by Bill Irwin,
@@ -394,7 +397,7 @@
if (nchunks == 0 && chunk == 0)
continue;
- bitmap_shift_left(maskp, maskp, CHUNKSZ, nmaskbits);
+ __bitmap_shift_left(maskp, maskp, CHUNKSZ, nmaskbits);
*maskp |= chunk;
nchunks++;
nbits += (nchunks == 1) ? nbits_to_hold_value(chunk) : CHUNKSZ;
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 9/15] mask3-unline-find-next-bit-ia64
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (7 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 8/15] mask2-bitmap-extensions Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 10/15] mask4-new-cpumask-h Paul Jackson
` (6 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask3-unline-find-next-bit-ia64
Move the page of code (~700 bytes of instructions)
for find_next_bit and find_next_zero_bit from inline
in include/asm-ia64/bitops.h to a real function in
arch/ia64/lib/bitops.c, leaving a declaration and
macro wrapper behind.
The other arch's with almost this same code might want to
also uninline it: alpha, parisc, ppc, sh, sparc, sparc64.
These are too big to inline.
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-ia64/bitops.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-ia64/bitops.h 2004-05-05 01:46:43.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-ia64/bitops.h 2004-05-05 02:45:50.000000000 -0700
@@ -11,7 +11,7 @@
#include <linux/compiler.h>
#include <linux/types.h>
-
+#include <asm/bitops.h>
#include <asm/intrinsics.h>
/**
@@ -359,93 +359,21 @@
#endif /* __KERNEL__ */
-/*
- * Find next zero bit in a bitmap reasonably efficiently..
- */
-static inline int
-find_next_zero_bit (void *addr, unsigned long size, unsigned long offset)
-{
- unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
- unsigned long result = offset & ~63UL;
- unsigned long tmp;
-
- if (offset >= size)
- return size;
- size -= result;
- offset &= 63UL;
- if (offset) {
- tmp = *(p++);
- tmp |= ~0UL >> (64-offset);
- if (size < 64)
- goto found_first;
- if (~tmp)
- goto found_middle;
- size -= 64;
- result += 64;
- }
- while (size & ~63UL) {
- if (~(tmp = *(p++)))
- goto found_middle;
- result += 64;
- size -= 64;
- }
- if (!size)
- return result;
- tmp = *p;
-found_first:
- tmp |= ~0UL << size;
- if (tmp == ~0UL) /* any bits zero? */
- return result + size; /* nope */
-found_middle:
- return result + ffz(tmp);
-}
+extern int __find_next_zero_bit (void *addr, unsigned long size, \
+ unsigned long offset);
+extern int __find_next_bit(const void *addr, unsigned long size, \
+ unsigned long offset);
+
+#define find_next_zero_bit(addr, size, offset) \
+ __find_next_zero_bit((addr), (size), (offset))
+#define find_next_bit(addr, size, offset) \
+ __find_next_bit((addr), (size), (offset))
/*
* The optimizer actually does good code for this case..
*/
#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
-/*
- * Find next bit in a bitmap reasonably efficiently..
- */
-static inline int
-find_next_bit(const void *addr, unsigned long size, unsigned long offset)
-{
- unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
- unsigned long result = offset & ~63UL;
- unsigned long tmp;
-
- if (offset >= size)
- return size;
- size -= result;
- offset &= 63UL;
- if (offset) {
- tmp = *(p++);
- tmp &= ~0UL << offset;
- if (size < 64)
- goto found_first;
- if (tmp)
- goto found_middle;
- size -= 64;
- result += 64;
- }
- while (size & ~63UL) {
- if ((tmp = *(p++)))
- goto found_middle;
- result += 64;
- size -= 64;
- }
- if (!size)
- return result;
- tmp = *p;
- found_first:
- tmp &= ~0UL >> (64-size);
- if (tmp == 0UL) /* Are any bits set? */
- return result + size; /* Nope. */
- found_middle:
- return result + __ffs(tmp);
-}
-
#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
#ifdef __KERNEL__
Index: 2.6.6-rc3-mm1-bitmapv5/arch/ia64/lib/bitop.c
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/arch/ia64/lib/bitop.c 2004-05-05 02:45:38.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/arch/ia64/lib/bitop.c 2004-05-05 02:45:50.000000000 -0700
@@ -0,0 +1,88 @@
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <asm/intrinsics.h>
+#include <linux/module.h>
+#include <asm/bitops.h>
+
+/*
+ * Find next zero bit in a bitmap reasonably efficiently..
+ */
+
+int __find_next_zero_bit (void *addr, unsigned long size, unsigned long offset)
+{
+ unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
+ unsigned long result = offset & ~63UL;
+ unsigned long tmp;
+
+ if (offset >= size)
+ return size;
+ size -= result;
+ offset &= 63UL;
+ if (offset) {
+ tmp = *(p++);
+ tmp |= ~0UL >> (64-offset);
+ if (size < 64)
+ goto found_first;
+ if (~tmp)
+ goto found_middle;
+ size -= 64;
+ result += 64;
+ }
+ while (size & ~63UL) {
+ if (~(tmp = *(p++)))
+ goto found_middle;
+ result += 64;
+ size -= 64;
+ }
+ if (!size)
+ return result;
+ tmp = *p;
+found_first:
+ tmp |= ~0UL << size;
+ if (tmp == ~0UL) /* any bits zero? */
+ return result + size; /* nope */
+found_middle:
+ return result + ffz(tmp);
+}
+EXPORT_SYMBOL(__find_next_zero_bit);
+
+/*
+ * Find next bit in a bitmap reasonably efficiently..
+ */
+int __find_next_bit(const void *addr, unsigned long size, unsigned long offset)
+{
+ unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
+ unsigned long result = offset & ~63UL;
+ unsigned long tmp;
+
+ if (offset >= size)
+ return size;
+ size -= result;
+ offset &= 63UL;
+ if (offset) {
+ tmp = *(p++);
+ tmp &= ~0UL << offset;
+ if (size < 64)
+ goto found_first;
+ if (tmp)
+ goto found_middle;
+ size -= 64;
+ result += 64;
+ }
+ while (size & ~63UL) {
+ if ((tmp = *(p++)))
+ goto found_middle;
+ result += 64;
+ size -= 64;
+ }
+ if (!size)
+ return result;
+ tmp = *p;
+ found_first:
+ tmp &= ~0UL >> (64-size);
+ if (tmp == 0UL) /* Are any bits set? */
+ return result + size; /* Nope. */
+ found_middle:
+ return result + __ffs(tmp);
+}
+EXPORT_SYMBOL(__find_next_bit);
Index: 2.6.6-rc3-mm1-bitmapv5/arch/ia64/lib/Makefile
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/arch/ia64/lib/Makefile 2004-05-05 01:45:17.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/arch/ia64/lib/Makefile 2004-05-05 02:45:50.000000000 -0700
@@ -6,7 +6,7 @@
lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
__divdi3.o __udivdi3.o __moddi3.o __umoddi3.o \
- checksum.o clear_page.o csum_partial_copy.o copy_page.o \
+ bitop.o checksum.o clear_page.o csum_partial_copy.o copy_page.o \
clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \
flush.o ip_fast_csum.o do_csum.o \
memset.o strlen.o swiotlb.o
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 10/15] mask4-new-cpumask-h
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (8 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 9/15] mask3-unline-find-next-bit-ia64 Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:48 ` [PATCH mask 11/15] mask5-remove-old-cpumask-files Paul Jackson
` (5 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask4-new-cpumask-h
Major rewrite of cpumask to use a single implementation,
as a struct-wrapped bitmap.
This patch leaves some 26 include/asm-*/cpumask*.h
header files orphaned - to be removed next patch.
Some nine cpumask macros for const variants and to
coerce and promote between an unsigned long and a
cpumask are obsolete. Simple emulation wrappers are
provided in this patch, which can be removed once each
of the 3 archs (i386, ppc64, x86_64) using them are
recoded in follow-on patches to not need them.
The CPU_MASK_ALL macro now avoids leaving possible
garbage one bits in any unused portion of the high word.
An inproved comment lists all available operators, for
convenient browsing.
Index: 2.6.6-rc3-mm2-bitmapv5/include/linux/cpumask.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/linux/cpumask.h 2004-05-06 01:26:56.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/linux/cpumask.h 2004-05-06 03:29:48.000000000 -0700
@@ -1,52 +1,335 @@
#ifndef __LINUX_CPUMASK_H
#define __LINUX_CPUMASK_H
+/*
+ * Cpumasks provide a bitmap suitable for representing the
+ * set of CPU's in a system, one bit position per CPU number.
+ *
+ * See detailed comments in the file linux/bitmap.h describing the
+ * data type on which these cpumasks are based.
+ *
+ * For details of cpumask_scnprintf() and cpumask_parse(),
+ * see bitmap_scnprintf() and bitmap_parse() in lib/bitmap.c.
+ *
+ * The available cpumask operations are:
+ *
+ * void cpu_set(cpu, mask) turn on bit 'cpu' in mask
+ * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask
+ * void cpus_setall(mask) set all bits
+ * void cpus_clear(mask) clear all bits
+ * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask
+ * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask
+ *
+ * void cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
+ * void cpus_or(dst, src1, src2) dst = src1 | src2 [union]
+ * void cpus_xor(dst, src1, src2) dst = src1 ^ src2
+ * void cpus_andnot(dst, src1, src2) dst = src1 & ~src2
+ * void cpus_complement(dst, src) dst = ~src
+ *
+ * int cpus_equal(mask1, mask2) Does mask1 == mask2?
+ * int cpus_intersects(mask1, mask2) Do mask1 and mask2 intersect?
+ * int cpus_subset(mask1, mask2) Is mask1 a subset of mask2?
+ * int cpus_empty(mask) Is mask empty (no bits sets)?
+ * int cpus_full(mask) Is mask full (all bits sets)?
+ * int cpus_weight(mask) Hamming weigh - number of set bits
+ *
+ * void cpus_shift_right(dst, src, n) Shift right
+ * void cpus_shift_left(dst, src, n) Shift left
+ *
+ * int first_cpu(mask) Number lowest set bit, or NR_CPUS
+ * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS
+ *
+ * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
+ * CPU_MASK_ALL Initializer - all bits set
+ * CPU_MASK_NONE Initializer - no bits set
+ * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
+ *
+ * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
+ * int cpumask_parse(ubuf, ulen, mask) Parse ascii string as cpumask
+ *
+ * int num_online_cpus() Number of online CPUs
+ * int num_possible_cpus() Number of all possible CPUs
+ * int cpu_online(cpu) Is some cpu online?
+ * int cpu_possible(cpu) Is some cpu possible?
+ * void cpu_set_online(cpu) set cpu in cpu_online_map
+ * void cpu_set_offline(cpu) clear cpu in cpu_online_map
+ * int any_online_cpu(mask) First online cpu in mask
+ *
+ * for_each_cpu_mask(cpu, mask) for-loop cpu over mask
+ * for_each_cpu(cpu) for-loop cpu over cpu_possible_map
+ * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
+ */
+
#include <linux/threads.h>
#include <linux/bitmap.h>
-#include <asm/cpumask.h>
#include <asm/bug.h>
-#ifdef CONFIG_SMP
+typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
+extern cpumask_t _unused_cpumask_arg_;
-extern cpumask_t cpu_online_map;
-extern cpumask_t cpu_possible_map;
+#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
+static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
+{
+ if (cpu < NR_CPUS)
+ set_bit(cpu, dstp->bits);
+}
+
+#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
+static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
+{
+ clear_bit(cpu, dstp->bits);
+}
+
+#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
+static inline void __cpus_setall(cpumask_t *dstp, int nbits)
+{
+ bitmap_fill(dstp->bits, nbits);
+}
+
+#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
+static inline void __cpus_clear(cpumask_t *dstp, int nbits)
+{
+ bitmap_zero(dstp->bits, nbits);
+}
+
+#define cpu_isset(cpu, cpumask) __cpu_isset((cpu), &(cpumask))
+static inline int __cpu_isset(int cpu, const volatile cpumask_t *addr)
+{
+ return test_bit(cpu, addr->bits);
+}
+
+#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
+static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
+{
+ if (cpu < NR_CPUS)
+ return test_and_set_bit(cpu, addr->bits);
+ else
+ return 0;
+}
+
+#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
+static inline void __cpus_and(cpumask_t *dstp, cpumask_t *src1p,
+ cpumask_t *src2p, int nbits)
+{
+ bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
+}
+
+#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
+static inline void __cpus_or(cpumask_t *dstp, cpumask_t *src1p,
+ cpumask_t *src2p, int nbits)
+{
+ bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
+}
+
+#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
+static inline void __cpus_xor(cpumask_t *dstp, cpumask_t *src1p,
+ cpumask_t *src2p, int nbits)
+{
+ bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
+}
+
+#define cpus_andnot(dst, src1, src2) \
+ __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
+static inline void __cpus_andnot(cpumask_t *dstp, cpumask_t *src1p,
+ cpumask_t *src2p, int nbits)
+{
+ bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
+}
+
+#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
+static inline void __cpus_complement(cpumask_t *dstp,
+ cpumask_t *srcp, int nbits)
+{
+ bitmap_complement(dstp->bits, srcp->bits, nbits);
+}
+
+#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
+static inline int __cpus_equal(cpumask_t *src1p,
+ cpumask_t *src2p, int nbits)
+{
+ return bitmap_equal(src1p->bits, src2p->bits, nbits);
+}
+
+#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
+static inline int __cpus_intersects(cpumask_t *src1p,
+ cpumask_t *src2p, int nbits)
+{
+ return bitmap_intersects(src1p->bits, src2p->bits, nbits);
+}
+
+#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
+static inline int __cpus_subset(cpumask_t *src1p,
+ cpumask_t *src2p, int nbits)
+{
+ return bitmap_subset(src1p->bits, src2p->bits, nbits);
+}
+
+#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
+static inline int __cpus_empty(cpumask_t *srcp, int nbits)
+{
+ return bitmap_empty(srcp->bits, nbits);
+}
+
+#define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS)
+static inline int __cpus_full(cpumask_t *srcp, int nbits)
+{
+ return bitmap_full(srcp->bits, nbits);
+}
+
+#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
+static inline int __cpus_weight(cpumask_t *srcp, int nbits)
+{
+ return bitmap_weight(srcp->bits, nbits);
+}
+
+#define cpus_shift_right(dst, src, n) \
+ __cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
+static inline void __cpus_shift_right(cpumask_t *dstp,
+ cpumask_t *srcp, int n, int nbits)
+{
+ bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
+}
+
+#define cpus_shift_left(dst, src, n) \
+ __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
+static inline void __cpus_shift_left(cpumask_t *dstp,
+ cpumask_t *srcp, int n, int nbits)
+{
+ bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
+}
+
+#define first_cpu(src) __first_cpu(&(src), NR_CPUS)
+static inline int __first_cpu(cpumask_t *srcp, int nbits)
+{
+ return find_first_bit(srcp->bits, nbits);
+}
+
+#define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS)
+static inline int __next_cpu(int n, cpumask_t *srcp, int nbits)
+{
+ return find_next_bit(srcp->bits, nbits, n+1);
+}
+
+#define cpumask_of_cpu(cpu) \
+({ \
+ typeof(_unused_cpumask_arg_) m; \
+ int c = cpu; \
+ if (sizeof(m) == sizeof(unsigned long)) { \
+ if (c < NR_CPUS) \
+ m.bits[0] = 1UL<<c; \
+ } else { \
+ cpus_clear(m); \
+ cpu_set(c, m); \
+ } \
+ m; \
+})
+
+#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
+
+#if NR_CPUS <= BITS_PER_LONG
+
+#define CPU_MASK_ALL \
+((cpumask_t) { { \
+ [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
+} })
-#define num_online_cpus() cpus_weight(cpu_online_map)
-#define num_possible_cpus() cpus_weight(cpu_possible_map)
+#else
-#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
-#define cpu_possible(cpu) cpu_isset(cpu, cpu_possible_map)
+#define CPU_MASK_ALL \
+((cpumask_t) { { \
+ [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
+ [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
+} })
-#define for_each_cpu_mask(cpu, mask) \
- for (cpu = first_cpu_const(mk_cpumask_const(mask)); \
- cpu < NR_CPUS; \
- cpu = next_cpu_const(cpu, mk_cpumask_const(mask)))
+#endif
-#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)
-#else
-#define cpu_online_map cpumask_of_cpu(0)
-#define cpu_possible_map cpumask_of_cpu(0)
+#define CPU_MASK_NONE \
+{ { \
+ [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
+} }
+
+#define cpus_addr(src) ((src).bits)
+
+#define cpumask_scnprintf(buf, len, src) \
+ __cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
+static inline int __cpumask_scnprintf(char *buf, int len,
+ cpumask_t *srcp, int nbits)
+{
+ return bitmap_scnprintf(buf, len, srcp->bits, nbits);
+}
+
+#define cpumask_parse(ubuf, ulen, src) \
+ __cpumask_parse((ubuf), (ulen), &(src), NR_CPUS)
+static inline int __cpumask_parse(const char __user *buf, int len,
+ cpumask_t *srcp, int nbits)
+{
+ return bitmap_parse(buf, len, srcp->bits, nbits);
+}
+
+/*
+ * The following particular system cpumasks and operations
+ * on them manage all (possible) and online cpus.
+ */
-#define num_online_cpus() 1
-#define num_possible_cpus() 1
+extern cpumask_t cpu_online_map;
+extern cpumask_t cpu_possible_map;
-#define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; })
-#define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; })
+#ifdef CONFIG_SMP
-#define for_each_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
-#define for_each_online_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
-#endif
+#define num_online_cpus() cpus_weight(cpu_online_map)
+#define num_possible_cpus() cpus_weight(cpu_possible_map)
+#define cpu_online(cpu) cpu_isset((cpu), cpu_online_map)
+#define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map)
+#define cpu_set_online(cpu) cpu_set((cpu), cpu_online_map)
+#define cpu_set_offline(cpu) cpu_clear((cpu), cpu_online_map)
+
+#define any_online_cpu(mask) \
+({ \
+ cpumask_t m; \
+ cpus_and(m, mask, cpu_online_map); \
+ first_cpu(m); \
+})
+
+#define for_each_cpu_mask(cpu, mask) \
+ for (cpu = first_cpu(mask); \
+ cpu < NR_CPUS; \
+ cpu = next_cpu(cpu, mask))
+
+#else /* !CONFIG_SMP */
+
+#define num_online_cpus() 1
+#define num_possible_cpus() 1
+#define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; })
+#define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; })
+#define cpu_set_online(cpu) ({ BUG_ON((cpu) != 0); })
+#define cpu_set_offline(cpu) ({ BUG(); })
+
+#define any_online_cpu(mask) 0
+
+#define for_each_cpu_mask(cpu, mask) for (cpu = 0; cpu < 1; cpu++)
+
+#endif /* CONFIG_SMP */
+
+#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)
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 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)
-
-#define cpumask_parse(buf, buflen, map) \
- bitmap_parse(buf, buflen, cpus_addr(map), NR_CPUS)
+/* Begin obsolete cpumask operator emulation */
+#define cpu_isset_const(a,b) cpu_isset(a,b)
+#define cpumask_const_t cpumask_t
+#define cpus_coerce(m) (cpus_addr(m)[0])
+#define cpus_coerce_const cpus_coerce
+#define cpus_promote(x) ({ cpumask_t m; m.bits[0] = x; m; })
+#define cpus_weight_const cpus_weight
+#define first_cpu_const first_cpu
+#define mk_cpumask_const(x) x
+#define next_cpu_const next_cpu
+/* End of obsolete cpumask operator emulation */
#endif /* __LINUX_CPUMASK_H */
Index: 2.6.6-rc3-mm2-bitmapv5/kernel/sched.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/kernel/sched.c 2004-05-06 03:25:44.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/kernel/sched.c 2004-05-06 03:29:32.000000000 -0700
@@ -3112,6 +3112,11 @@
return retval;
}
+#ifndef CONFIG_SMP
+cpumask_t cpu_online_map = CPU_MASK_ALL;
+cpumask_t cpu_possible_map = CPU_MASK_ALL;
+#endif
+
/**
* sys_sched_getaffinity - get the cpu affinity of a process
* @pid: pid of the process
Index: 2.6.6-rc3-mm2-bitmapv5/arch/sparc64/kernel/irq.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/sparc64/kernel/irq.c 2004-05-06 00:08:13.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/sparc64/kernel/irq.c 2004-05-06 03:29:32.000000000 -0700
@@ -687,9 +687,10 @@
* Just Do It.
*/
struct irqaction *ap = bp->irq_info;
- cpumask_t cpu_mask = get_smpaff_in_irqaction(ap);
+ cpumask_t cpu_mask;
unsigned int buddy, ticks;
+ cpus_addr(cpu_mask)[0] = get_smpaff_in_irqaction(ap);
cpus_and(cpu_mask, cpu_mask, cpu_online_map);
if (cpus_empty(cpu_mask))
cpu_mask = cpu_online_map;
@@ -1206,9 +1207,10 @@
{
struct ino_bucket *bp = ivector_table + (long)data;
struct irqaction *ap = bp->irq_info;
- cpumask_t mask = get_smpaff_in_irqaction(ap);
+ cpumask_t mask;
int len;
+ cpus_addr(mask)[0] = get_smpaff_in_irqaction(ap);
if (cpus_empty(mask))
mask = cpu_online_map;
Index: 2.6.6-rc3-mm2-bitmapv5/kernel/rcupdate.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/kernel/rcupdate.c 2004-05-06 00:08:13.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/kernel/rcupdate.c 2004-05-06 03:29:32.000000000 -0700
@@ -103,8 +103,6 @@
*/
static void rcu_start_batch(long newbatch)
{
- cpumask_t active;
-
if (rcu_batch_before(rcu_ctrlblk.maxbatch, newbatch)) {
rcu_ctrlblk.maxbatch = newbatch;
}
@@ -113,9 +111,7 @@
return;
}
/* Can't change, since spin lock held. */
- active = idle_cpu_mask;
- cpus_complement(active);
- cpus_and(rcu_ctrlblk.rcu_cpu_mask, cpu_online_map, active);
+ cpus_andnot(rcu_ctrlblk.rcu_cpu_mask, cpu_online_map, idle_cpu_mask);
}
/*
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 11/15] mask5-remove-old-cpumask-files
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (9 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 10/15] mask4-new-cpumask-h Paul Jackson
@ 2004-05-06 18:48 ` Paul Jackson
2004-05-06 18:49 ` [PATCH mask 12/15] mask6-cpumask-i386-fixup Paul Jackson
` (4 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:48 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask5-remove-old-cpumask-files
With the cpumask rewrite in the previous patch, these
various include/asm-*/cpumask*.h headers are no longer used.
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-alpha/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-alpha/cpumask.h 2004-05-05 01:46:36.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-alpha/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_ALPHA_CPUMASK_H
-#define _ASM_ALPHA_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_ALPHA_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-arm/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-arm/cpumask.h 2004-05-05 01:46:36.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-arm/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_ARM_CPUMASK_H
-#define _ASM_ARM_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_ARM_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-arm26/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-arm26/cpumask.h 2004-05-05 01:46:37.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-arm26/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_ARM26_CPUMASK_H
-#define _ASM_ARM26_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_ARM26_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-cris/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-cris/cpumask.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-cris/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_CRIS_CPUMASK_H
-#define _ASM_CRIS_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_CRIS_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-generic/cpumask.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,40 +0,0 @@
-#ifndef __ASM_GENERIC_CPUMASK_H
-#define __ASM_GENERIC_CPUMASK_H
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/threads.h>
-#include <linux/types.h>
-#include <linux/bitmap.h>
-
-#if NR_CPUS > BITS_PER_LONG && NR_CPUS != 1
-#define CPU_ARRAY_SIZE BITS_TO_LONGS(NR_CPUS)
-
-struct cpumask
-{
- unsigned long mask[CPU_ARRAY_SIZE];
-};
-
-typedef struct cpumask cpumask_t;
-
-#else
-typedef unsigned long cpumask_t;
-#endif
-
-#ifdef CONFIG_SMP
-#if NR_CPUS > BITS_PER_LONG
-#include <asm-generic/cpumask_array.h>
-#else
-#include <asm-generic/cpumask_arith.h>
-#endif
-#else
-#include <asm-generic/cpumask_up.h>
-#endif
-
-#if NR_CPUS <= 4*BITS_PER_LONG
-#include <asm-generic/cpumask_const_value.h>
-#else
-#include <asm-generic/cpumask_const_reference.h>
-#endif
-
-#endif /* __ASM_GENERIC_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_arith.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-generic/cpumask_arith.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_arith.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,49 +0,0 @@
-#ifndef __ASM_GENERIC_CPUMASK_ARITH_H
-#define __ASM_GENERIC_CPUMASK_ARITH_H
-
-/*
- * Arithmetic type -based cpu bitmaps. A single unsigned long is used
- * 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_isset(cpu, map) test_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)
-#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_addr(map) (&(map))
-
-#if BITS_PER_LONG == 32
-#define cpus_weight(map) hweight32(map)
-#elif BITS_PER_LONG == 64
-#define cpus_weight(map) hweight64(map)
-#endif
-
-#define cpus_shift_right(dst, src, n) do { dst = (src) >> (n); } while (0)
-#define cpus_shift_left(dst, src, n) do { dst = (src) << (n); } while (0)
-
-#define any_online_cpu(map) \
-({ \
- cpumask_t __tmp__; \
- cpus_and(__tmp__, map, cpu_online_map); \
- __tmp__ ? first_cpu(__tmp__) : NR_CPUS; \
-})
-
-#define CPU_MASK_ALL (~((cpumask_t)0) >> (8*sizeof(cpumask_t) - NR_CPUS))
-#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_promote(map) ({ map; })
-#define cpumask_of_cpu(cpu) ({ ((cpumask_t)1) << (cpu); })
-
-#define first_cpu(map) find_first_bit(&(map), NR_CPUS)
-#define next_cpu(cpu, map) find_next_bit(&(map), NR_CPUS, cpu + 1)
-
-#endif /* __ASM_GENERIC_CPUMASK_ARITH_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_array.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-generic/cpumask_array.h 2004-05-05 02:18:22.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_array.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,54 +0,0 @@
-#ifndef __ASM_GENERIC_CPUMASK_ARRAY_H
-#define __ASM_GENERIC_CPUMASK_ARRAY_H
-
-/*
- * Array-based cpu bitmaps. An array of unsigned longs is used to contain
- * the bitmap, and then contained in a structure so it may be passed by
- * value.
- */
-
-#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 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)
-#define cpus_clear(map) bitmap_zero((map).mask, NR_CPUS)
-#define cpus_complement(map) bitmap_complement((map).mask, (map).mask, NR_CPUS)
-#define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
-#define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS)
-#define cpus_addr(map) ((map).mask)
-#define cpus_weight(map) bitmap_weight((map).mask, NR_CPUS)
-#define cpus_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, NR_CPUS)
-#define cpus_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, NR_CPUS)
-#define first_cpu(map) find_first_bit((map).mask, NR_CPUS)
-#define next_cpu(cpu, map) find_next_bit((map).mask, NR_CPUS, cpu + 1)
-
-/* only ever use this for things that are _never_ used on large boxen */
-#define cpus_coerce(map) ((map).mask[0])
-#define cpus_promote(map) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
- __cpu_mask.mask[0] = map; \
- __cpu_mask; \
- })
-#define cpumask_of_cpu(cpu) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
- cpu_set(cpu, __cpu_mask); \
- __cpu_mask; \
- })
-#define any_online_cpu(map) \
-({ \
- cpumask_t __tmp__; \
- cpus_and(__tmp__, map, cpu_online_map); \
- find_first_bit(__tmp__.mask, NR_CPUS); \
-})
-
-
-/*
- * um, these need to be usable as static initializers
- */
-#define CPU_MASK_ALL ((cpumask_t) { {[0 ... CPU_ARRAY_SIZE-1] = ~0UL} })
-#define CPU_MASK_NONE ((cpumask_t) { {[0 ... CPU_ARRAY_SIZE-1] = 0UL} })
-
-#endif /* __ASM_GENERIC_CPUMASK_ARRAY_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_const_reference.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-generic/cpumask_const_reference.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_const_reference.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,29 +0,0 @@
-#ifndef __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H
-#define __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H
-
-struct cpumask_ref {
- const cpumask_t *val;
-};
-
-typedef const struct cpumask_ref cpumask_const_t;
-
-#define mk_cpumask_const(map) ((cpumask_const_t){ &(map) })
-#define cpu_isset_const(cpu, map) cpu_isset(cpu, *(map).val)
-
-#define cpus_and_const(dst,src1,src2) cpus_and(dst,*(src1).val,*(src2).val)
-#define cpus_or_const(dst,src1,src2) cpus_or(dst,*(src1).val,*(src2).val)
-
-#define cpus_equal_const(map1, map2) cpus_equal(*(map1).val, *(map2).val)
-
-#define cpus_copy_const(map1, map2) bitmap_copy((map1).mask, (map2).val->mask, NR_CPUS)
-
-#define cpus_empty_const(map) cpus_empty(*(map).val)
-#define cpus_weight_const(map) cpus_weight(*(map).val)
-#define first_cpu_const(map) first_cpu(*(map).val)
-#define next_cpu_const(cpu, map) next_cpu(cpu, *(map).val)
-
-/* only ever use this for things that are _never_ used on large boxen */
-#define cpus_coerce_const(map) cpus_coerce(*(map).val)
-#define any_online_cpu_const(map) any_online_cpu(*(map).val)
-
-#endif /* __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_const_value.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-generic/cpumask_const_value.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_const_value.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,21 +0,0 @@
-#ifndef __ASM_GENERIC_CPUMASK_CONST_VALUE_H
-#define __ASM_GENERIC_CPUMASK_CONST_VALUE_H
-
-typedef const cpumask_t cpumask_const_t;
-
-#define mk_cpumask_const(map) (map)
-#define cpu_isset_const(cpu, map) cpu_isset(cpu, map)
-#define cpus_and_const(dst,src1,src2) cpus_and(dst, src1, src2)
-#define cpus_or_const(dst,src1,src2) cpus_or(dst, src1, src2)
-#define cpus_equal_const(map1, map2) cpus_equal(map1, map2)
-#define cpus_empty_const(map) cpus_empty(map)
-#define cpus_copy_const(map1, map2) do { map1 = (cpumask_t)map2; } while (0)
-#define cpus_weight_const(map) cpus_weight(map)
-#define first_cpu_const(map) first_cpu(map)
-#define next_cpu_const(cpu, map) next_cpu(cpu, map)
-
-/* only ever use this for things that are _never_ used on large boxen */
-#define cpus_coerce_const(map) cpus_coerce(map)
-#define any_online_cpu_const(map) any_online_cpu(map)
-
-#endif /* __ASM_GENERIC_CPUMASK_CONST_VALUE_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_up.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-generic/cpumask_up.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-generic/cpumask_up.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,59 +0,0 @@
-#ifndef __ASM_GENERIC_CPUMASK_UP_H
-#define __ASM_GENERIC_CPUMASK_UP_H
-
-#define cpus_coerce(map) (map)
-
-#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 cpus_and(dst, src1, src2) \
- do { \
- if (cpus_coerce(src1) && cpus_coerce(src2)) \
- cpus_coerce(dst) = 1UL; \
- else \
- cpus_coerce(dst) = 0UL; \
- } while (0)
-
-#define cpus_or(dst, src1, src2) \
- do { \
- if (cpus_coerce(src1) || cpus_coerce(src2)) \
- cpus_coerce(dst) = 1UL; \
- else \
- cpus_coerce(dst) = 0UL; \
- } while (0)
-
-#define cpus_clear(map) do { cpus_coerce(map) = 0UL; } while (0)
-
-#define cpus_complement(map) \
- do { \
- cpus_coerce(map) = !cpus_coerce(map); \
- } while (0)
-
-#define cpus_equal(map1, map2) (cpus_coerce(map1) == cpus_coerce(map2))
-#define cpus_empty(map) (cpus_coerce(map) == 0UL)
-#define cpus_addr(map) (&(map))
-#define cpus_weight(map) (cpus_coerce(map) ? 1UL : 0UL)
-#define cpus_shift_right(d, s, n) do { cpus_coerce(d) = 0UL; } while (0)
-#define cpus_shift_left(d, s, n) do { cpus_coerce(d) = 0UL; } while (0)
-#define first_cpu(map) (cpus_coerce(map) ? 0 : 1)
-#define next_cpu(cpu, map) 1
-
-/* only ever use this for things that are _never_ used on large boxen */
-#define cpus_promote(map) \
- ({ \
- cpumask_t __tmp__; \
- cpus_coerce(__tmp__) = map; \
- __tmp__; \
- })
-#define cpumask_of_cpu(cpu) ((void)(cpu), cpus_promote(1))
-#define any_online_cpu(map) (cpus_coerce(map) ? 0 : 1)
-
-/*
- * um, these need to be usable as static initializers
- */
-#define CPU_MASK_ALL 1UL
-#define CPU_MASK_NONE 0UL
-
-#endif /* __ASM_GENERIC_CPUMASK_UP_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-h8300/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-h8300/cpumask.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-h8300/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_H8300_CPUMASK_H
-#define _ASM_H8300_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_H8300_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-i386/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-i386/cpumask.h 2004-05-05 01:46:42.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-i386/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_I386_CPUMASK_H
-#define _ASM_I386_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_I386_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-m68k/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-m68k/cpumask.h 2004-05-05 01:46:44.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-m68k/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_M68K_CPUMASK_H
-#define _ASM_M68K_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_M68K_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-m68knommu/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-m68knommu/cpumask.h 2004-05-05 01:46:45.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-m68knommu/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_M68KNOMMU_CPUMASK_H
-#define _ASM_M68KNOMMU_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_M68KNOMMU_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-mips/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-mips/cpumask.h 2004-05-05 01:46:46.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-mips/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_MIPS_CPUMASK_H
-#define _ASM_MIPS_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_MIPS_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-parisc/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-parisc/cpumask.h 2004-05-05 01:46:47.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-parisc/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_PARISC_CPUMASK_H
-#define _ASM_PARISC_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_PARISC_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-ppc/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-ppc/cpumask.h 2004-05-05 01:46:47.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-ppc/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_PPC_CPUMASK_H
-#define _ASM_PPC_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_PPC_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-ppc64/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-ppc64/cpumask.h 2004-05-05 01:46:48.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-ppc64/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_PPC64_CPUMASK_H
-#define _ASM_PPC64_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_PPC64_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-s390/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-s390/cpumask.h 2004-05-05 01:46:48.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-s390/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_S390_CPUMASK_H
-#define _ASM_S390_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_S390_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-sh/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-sh/cpumask.h 2004-05-05 01:46:49.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-sh/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_SH_CPUMASK_H
-#define _ASM_SH_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_SH_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-sparc/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-sparc/cpumask.h 2004-05-05 01:46:50.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-sparc/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_SPARC_CPUMASK_H
-#define _ASM_SPARC_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_SPARC_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-sparc64/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-sparc64/cpumask.h 2004-05-05 01:46:50.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-sparc64/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_SPARC64_CPUMASK_H
-#define _ASM_SPARC64_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_SPARC64_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-um/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-um/cpumask.h 2004-05-05 01:46:51.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-um/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_UM_CPUMASK_H
-#define _ASM_UM_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_UM_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-v850/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-v850/cpumask.h 2004-05-05 01:46:51.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-v850/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_V850_CPUMASK_H
-#define _ASM_V850_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_V850_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-x86_64/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-x86_64/cpumask.h 2004-05-05 01:46:51.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-x86_64/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_X86_64_CPUMASK_H
-#define _ASM_X86_64_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_X86_64_CPUMASK_H */
Index: 2.6.6-rc3-mm1-bitmapv5/include/asm-ia64/cpumask.h
===================================================================
--- 2.6.6-rc3-mm1-bitmapv5.orig/include/asm-ia64/cpumask.h 2004-05-05 01:46:43.000000000 -0700
+++ 2.6.6-rc3-mm1-bitmapv5/include/asm-ia64/cpumask.h 1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_IA64_CPUMASK_H
-#define _ASM_IA64_CPUMASK_H
-
-#include <asm-generic/cpumask.h>
-
-#endif /* _ASM_IA64_CPUMASK_H */
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 12/15] mask6-cpumask-i386-fixup
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (10 preceding siblings ...)
2004-05-06 18:48 ` [PATCH mask 11/15] mask5-remove-old-cpumask-files Paul Jackson
@ 2004-05-06 18:49 ` Paul Jackson
2004-05-06 18:49 ` [PATCH mask 13/15] mask7-cpumask-etc-fixup Paul Jackson
` (3 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:49 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask6-cpumask-i386-fixup
Remove by recoding i386 uses of the obsolete cpumask const,
coerce and promote macros.
Index: 2.6.6-rc3-mm2-bitmapv5/arch/i386/kernel/io_apic.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/i386/kernel/io_apic.c 2004-05-05 06:11:14.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/i386/kernel/io_apic.c 2004-05-05 06:36:07.000000000 -0700
@@ -264,7 +264,7 @@
struct irq_pin_list *entry = irq_2_pin + irq;
unsigned int apicid_value;
- apicid_value = cpu_mask_to_apicid(mk_cpumask_const(cpumask));
+ apicid_value = cpu_mask_to_apicid(cpumask);
/* Prepare to do the io_apic_write */
apicid_value = apicid_value << 24;
spin_lock_irqsave(&ioapic_lock, flags);
Index: 2.6.6-rc3-mm2-bitmapv5/arch/i386/kernel/smp.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/i386/kernel/smp.c 2004-05-05 06:11:35.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/i386/kernel/smp.c 2004-05-05 06:36:07.000000000 -0700
@@ -159,7 +159,7 @@
*/
inline void send_IPI_mask_bitmask(cpumask_t cpumask, int vector)
{
- unsigned long mask = cpus_coerce(cpumask);
+ unsigned long mask = cpus_addr(cpumask)[0];
unsigned long cfg;
unsigned long flags;
Index: 2.6.6-rc3-mm2-bitmapv5/arch/i386/mach-voyager/voyager_smp.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/i386/mach-voyager/voyager_smp.c 2004-05-05 06:11:35.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/i386/mach-voyager/voyager_smp.c 2004-05-05 06:36:07.000000000 -0700
@@ -153,7 +153,7 @@
send_CPI_allbutself(__u8 cpi)
{
__u8 cpu = smp_processor_id();
- __u32 mask = cpus_coerce(cpu_online_map) & ~(1 << cpu);
+ __u32 mask = cpus_addr(cpu_online_map)[0] & ~(1 << cpu);
send_CPI(mask, cpi);
}
@@ -402,11 +402,11 @@
/* set up everything for just this CPU, we can alter
* this as we start the other CPUs later */
/* now get the CPU disposition from the extended CMOS */
- phys_cpu_present_map = cpus_promote(voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK));
- cpus_coerce(phys_cpu_present_map) |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
- cpus_coerce(phys_cpu_present_map) |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16;
- cpus_coerce(phys_cpu_present_map) |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24;
- printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_coerce(phys_cpu_present_map));
+ cpus_addr(phys_cpu_present_map)[0] = voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK);
+ cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
+ cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16;
+ cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24;
+ printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]);
/* Here we set up the VIC to enable SMP */
/* enable the CPIs by writing the base vector to their register */
outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER);
@@ -706,12 +706,12 @@
/* now that the cat has probed the Voyager System Bus, sanity
* check the cpu map */
if( ((voyager_quad_processors | voyager_extended_vic_processors)
- & cpus_coerce(phys_cpu_present_map)) != cpus_coerce(phys_cpu_present_map)) {
+ & cpus_addr(phys_cpu_present_map)[0]) != cpus_addr(phys_cpu_present_map)[0]) {
/* should panic */
printk("\n\n***WARNING*** Sanity check of CPU present map FAILED\n");
}
} else if(voyager_level == 4)
- voyager_extended_vic_processors = cpus_coerce(phys_cpu_present_map);
+ voyager_extended_vic_processors = cpus_addr(phys_cpu_present_map)[0];
/* this sets up the idle task to run on the current cpu */
voyager_extended_cpus = 1;
@@ -909,7 +909,7 @@
if (!cpumask)
BUG();
- if ((cpumask & cpus_coerce(cpu_online_map)) != cpumask)
+ if ((cpumask & cpus_addr(cpu_online_map)[0]) != cpumask)
BUG();
if (cpumask & (1 << smp_processor_id()))
BUG();
@@ -952,7 +952,7 @@
preempt_disable();
- cpu_mask = cpus_coerce(mm->cpu_vm_mask) & ~(1 << smp_processor_id());
+ cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id());
local_flush_tlb();
if (cpu_mask)
flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
@@ -968,7 +968,7 @@
preempt_disable();
- cpu_mask = cpus_coerce(mm->cpu_vm_mask) & ~(1 << smp_processor_id());
+ cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id());
if (current->active_mm == mm) {
if (current->mm)
@@ -989,7 +989,7 @@
preempt_disable();
- cpu_mask = cpus_coerce(mm->cpu_vm_mask) & ~(1 << smp_processor_id());
+ cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id());
if (current->active_mm == mm) {
if(current->mm)
__flush_tlb_one(va);
@@ -1098,7 +1098,7 @@
int wait)
{
struct call_data_struct data;
- __u32 mask = cpus_coerce(cpu_online_map);
+ __u32 mask = cpus_addr(cpu_online_map)[0];
mask &= ~(1<<smp_processor_id());
@@ -1789,9 +1789,9 @@
unsigned long irq_mask = 1 << irq;
int cpu;
- real_mask = cpus_coerce(mask) & voyager_extended_vic_processors;
+ real_mask = cpus_addr(mask)[0] & voyager_extended_vic_processors;
- if(cpus_coerce(mask) == 0)
+ if(cpus_addr(mask)[0] == 0)
/* can't have no cpu's to accept the interrupt -- extremely
* bad things will happen */
return;
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/genapic.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/genapic.h 2004-05-05 06:35:41.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/genapic.h 2004-05-05 06:36:07.000000000 -0700
@@ -63,7 +63,7 @@
unsigned (*get_apic_id)(unsigned long x);
unsigned long apic_id_mask;
- unsigned int (*cpu_mask_to_apicid)(cpumask_const_t cpumask);
+ unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
/* ipi */
void (*send_IPI_mask)(cpumask_t mask, int vector);
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-bigsmp/mach_apic.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mach-bigsmp/mach_apic.h 2004-05-05 06:08:47.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-bigsmp/mach_apic.h 2004-05-05 06:36:07.000000000 -0700
@@ -140,14 +140,14 @@
return (1);
}
-static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
int num_bits_set;
int cpus_found = 0;
int cpu;
int apicid;
- num_bits_set = cpus_weight_const(cpumask);
+ num_bits_set = cpus_weight(cpumask);
/* Return id to all */
if (num_bits_set == NR_CPUS)
return (int) 0xFF;
@@ -155,10 +155,10 @@
* The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of TARGET_CPUS.
*/
- cpu = first_cpu_const(cpumask);
+ cpu = first_cpu(cpumask);
apicid = cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) {
- if (cpu_isset_const(cpu, cpumask)) {
+ if (cpu_isset(cpu, cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-default/mach_apic.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mach-default/mach_apic.h 2004-05-05 06:08:47.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-default/mach_apic.h 2004-05-05 06:36:07.000000000 -0700
@@ -5,12 +5,12 @@
#define APIC_DFR_VALUE (APIC_DFR_FLAT)
-static inline cpumask_const_t target_cpus(void)
+static inline cpumask_t target_cpus(void)
{
#ifdef CONFIG_SMP
- return mk_cpumask_const(cpu_online_map);
+ return cpu_online_map;
#else
- return mk_cpumask_const(cpumask_of_cpu(0));
+ return cpumask_of_cpu(0);
#endif
}
#define TARGET_CPUS (target_cpus())
@@ -118,9 +118,9 @@
return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map);
}
-static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
- return cpus_coerce_const(cpumask);
+ return cpus_addr(cpumask)[0];
}
static inline void enable_apic_mode(void)
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-es7000/mach_apic.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mach-es7000/mach_apic.h 2004-05-05 06:11:24.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-es7000/mach_apic.h 2004-05-05 06:36:07.000000000 -0700
@@ -89,7 +89,7 @@
int apic = bios_cpu_apicid[smp_processor_id()];
printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
(apic_version[apic] == 0x14) ?
- "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_coerce(TARGET_CPUS));
+ "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]);
}
static inline int multi_timer_check(int apic, int irq)
@@ -159,14 +159,14 @@
return (1);
}
-static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
int num_bits_set;
int cpus_found = 0;
int cpu;
int apicid;
- num_bits_set = cpus_weight_const(cpumask);
+ num_bits_set = cpus_weight(cpumask);
/* Return id to all */
if (num_bits_set == NR_CPUS)
#if defined CONFIG_ES7000_CLUSTERED_APIC
@@ -178,10 +178,10 @@
* The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of TARGET_CPUS.
*/
- cpu = first_cpu_const(cpumask);
+ cpu = first_cpu(cpumask);
apicid = cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) {
- if (cpu_isset_const(cpu, cpumask)) {
+ if (cpu_isset(cpu, cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-numaq/mach_apic.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mach-numaq/mach_apic.h 2004-05-05 06:08:47.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-numaq/mach_apic.h 2004-05-05 06:36:07.000000000 -0700
@@ -136,7 +136,7 @@
* We use physical apicids here, not logical, so just return the default
* physical broadcast to stop people from breaking us
*/
-static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
return (int) 0xF;
}
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-summit/mach_apic.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mach-summit/mach_apic.h 2004-05-05 06:08:47.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-summit/mach_apic.h 2004-05-05 06:36:07.000000000 -0700
@@ -140,14 +140,14 @@
{
}
-static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
int num_bits_set;
int cpus_found = 0;
int cpu;
int apicid;
- num_bits_set = cpus_weight_const(cpumask);
+ num_bits_set = cpus_weight(cpumask);
/* Return id to all */
if (num_bits_set == NR_CPUS)
return (int) 0xFF;
@@ -155,10 +155,10 @@
* The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of TARGET_CPUS.
*/
- cpu = first_cpu_const(cpumask);
+ cpu = first_cpu(cpumask);
apicid = cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) {
- if (cpu_isset_const(cpu, cpumask)) {
+ if (cpu_isset(cpu, cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-visws/mach_apic.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mach-visws/mach_apic.h 2004-05-05 06:08:47.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-visws/mach_apic.h 2004-05-05 06:36:07.000000000 -0700
@@ -84,9 +84,9 @@
return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
}
-static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
- return cpus_coerce_const(cpumask);
+ return cpus_addr(cpumask)[0];
}
static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 13/15] mask7-cpumask-etc-fixup
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (11 preceding siblings ...)
2004-05-06 18:49 ` [PATCH mask 12/15] mask6-cpumask-i386-fixup Paul Jackson
@ 2004-05-06 18:49 ` Paul Jackson
2004-05-06 18:49 ` [PATCH mask 14/15] mask8-rm-old-cpumask-emul Paul Jackson
` (2 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:49 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask7-cpumask-etc-fixup
Remove by recoding other uses of the obsolete cpumask const,
coerce and promote macros.
Index: 2.6.6-rc3-mm2-bitmapv5/arch/ppc64/kernel/open_pic.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/ppc64/kernel/open_pic.c 2004-05-05 06:07:40.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/ppc64/kernel/open_pic.c 2004-05-05 06:36:15.000000000 -0700
@@ -591,7 +591,7 @@
void openpic_init_processor(u_int cpumask)
{
openpic_write(&OpenPIC->Global.Processor_Initialization,
- physmask(cpumask & cpus_coerce(cpu_online_map)));
+ physmask(cpumask & cpus_addr(cpu_online_map)[0]));
}
#ifdef CONFIG_SMP
@@ -625,7 +625,7 @@
CHECK_THIS_CPU;
check_arg_ipi(ipi);
openpic_write(&OpenPIC->THIS_CPU.IPI_Dispatch(ipi),
- physmask(cpumask & cpus_coerce(cpu_online_map)));
+ physmask(cpumask & cpus_addr(cpu_online_map)[0]));
}
void openpic_request_IPIs(void)
@@ -711,7 +711,7 @@
{
check_arg_timer(timer);
openpic_write(&OpenPIC->Global.Timer[timer].Destination,
- physmask(cpumask & cpus_coerce(cpu_online_map)));
+ physmask(cpumask & cpus_addr(cpu_online_map)[0]));
}
@@ -844,7 +844,7 @@
cpumask_t tmp;
cpus_and(tmp, cpumask, cpu_online_map);
- openpic_mapirq(irq_nr - open_pic_irq_offset, physmask(cpus_coerce(tmp)));
+ openpic_mapirq(irq_nr - open_pic_irq_offset, physmask(cpus_addr(tmp)[0]));
}
#ifdef CONFIG_SMP
Index: 2.6.6-rc3-mm2-bitmapv5/arch/ppc64/kernel/rtasd.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/ppc64/kernel/rtasd.c 2004-05-05 06:07:40.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/ppc64/kernel/rtasd.c 2004-05-05 06:36:15.000000000 -0700
@@ -415,7 +415,7 @@
}
lock_cpu_hotplug();
- cpu = first_cpu_const(mk_cpumask_const(cpu_online_map));
+ cpu = first_cpu(cpu_online_map);
for (;;) {
set_cpus_allowed(current, cpumask_of_cpu(cpu));
do_event_scan(event_scan);
@@ -429,9 +429,9 @@
schedule_timeout((HZ*60/rtas_event_scan_rate) / 2);
lock_cpu_hotplug();
- cpu = next_cpu_const(cpu, mk_cpumask_const(cpu_online_map));
+ cpu = next_cpu(cpu, cpu_online_map);
if (cpu == NR_CPUS)
- cpu = first_cpu_const(mk_cpumask_const(cpu_online_map));
+ cpu = first_cpu(cpu_online_map);
}
error:
Index: 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/io_apic.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/x86_64/kernel/io_apic.c 2004-05-05 06:11:36.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/io_apic.c 2004-05-05 06:36:15.000000000 -0700
@@ -1383,7 +1383,7 @@
unsigned long flags;
unsigned int dest;
- dest = cpu_mask_to_apicid(mk_cpumask_const(mask));
+ dest = cpu_mask_to_apicid(mask);
/*
* Only the first 8 bits are valid.
Index: 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/pci-gart.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/x86_64/kernel/pci-gart.c 2004-05-05 06:07:49.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/pci-gart.c 2004-05-05 06:36:15.000000000 -0700
@@ -149,7 +149,7 @@
{
unsigned long flags;
int bus = dev ? dev->bus->number : -1;
- cpumask_const_t bus_cpumask = pcibus_to_cpumask(bus);
+ cpumask_t bus_cpumask = pcibus_to_cpumask(bus);
int flushed = 0;
int i;
@@ -159,7 +159,7 @@
u32 w;
if (!northbridges[i])
continue;
- if (bus >= 0 && !(cpu_isset_const(i, bus_cpumask)))
+ if (bus >= 0 && !(cpu_isset(i, bus_cpumask)))
continue;
pci_write_config_dword(northbridges[i], 0x9c,
northbridge_flush_word[i] | 1);
Index: 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/smp.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/x86_64/kernel/smp.c 2004-05-05 06:11:35.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/x86_64/kernel/smp.c 2004-05-05 06:36:15.000000000 -0700
@@ -94,7 +94,7 @@
static inline void send_IPI_mask(cpumask_t cpumask, int vector)
{
- unsigned long mask = cpus_coerce(cpumask);
+ unsigned long mask = cpus_addr(cpumask)[0];
unsigned long cfg;
unsigned long flags;
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/smp.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-x86_64/smp.h 2004-05-05 06:09:00.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/smp.h 2004-05-05 06:36:15.000000000 -0700
@@ -105,7 +105,6 @@
return BAD_APICID;
}
-#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
#endif /* !ASSEMBLY */
#define NO_PROC_ID 0xFF /* No processor magic marker */
@@ -115,9 +114,9 @@
#define TARGET_CPUS 1
#ifndef ASSEMBLY
-static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
- return cpus_coerce_const(cpumask);
+ return cpus_addr(cpumask)[0];
}
#endif
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 14/15] mask8-rm-old-cpumask-emul
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (12 preceding siblings ...)
2004-05-06 18:49 ` [PATCH mask 13/15] mask7-cpumask-etc-fixup Paul Jackson
@ 2004-05-06 18:49 ` Paul Jackson
2004-05-06 18:49 ` [PATCH mask 15/15] mask9-post-cleanup-tweaks Paul Jackson
2004-05-07 9:53 ` [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:49 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask8-rm-old-cpumask-emul
Now that the emulation of the obsolete cpumask macros is no
longer needed, remove it from cpumask.h
Index: 2.6.6-rc3-mm2-bitmapv5/include/linux/cpumask.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/linux/cpumask.h 2004-05-06 03:29:48.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/linux/cpumask.h 2004-05-06 03:30:05.000000000 -0700
@@ -320,16 +320,4 @@
#define cpu_present(cpu) cpu_isset(cpu, cpu_present_map)
#define for_each_present_cpu(cpu) for_each_cpu_mask(cpu, cpu_present_map)
-/* Begin obsolete cpumask operator emulation */
-#define cpu_isset_const(a,b) cpu_isset(a,b)
-#define cpumask_const_t cpumask_t
-#define cpus_coerce(m) (cpus_addr(m)[0])
-#define cpus_coerce_const cpus_coerce
-#define cpus_promote(x) ({ cpumask_t m; m.bits[0] = x; m; })
-#define cpus_weight_const cpus_weight
-#define first_cpu_const first_cpu
-#define mk_cpumask_const(x) x
-#define next_cpu_const next_cpu
-/* End of obsolete cpumask operator emulation */
-
#endif /* __LINUX_CPUMASK_H */
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH mask 15/15] mask9-post-cleanup-tweaks
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (13 preceding siblings ...)
2004-05-06 18:49 ` [PATCH mask 14/15] mask8-rm-old-cpumask-emul Paul Jackson
@ 2004-05-06 18:49 ` Paul Jackson
2004-05-07 9:53 ` [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-06 18:49 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Matthew Dobson, William Lee Irwin III,
Rusty Russell, Joe Korty, Jesse Barnes
mask9-post-cleanup-tweaks
Make use of for_each_cpu_mask() macro to simplify and optimize
a couple of sparc64 per-CPU loops.
Optimize a bit of cpumask code for asm-i386/mach-es7000
Convert physids_complement() to use both args in the files
include/asm-i386/mpspec.h, include/asm-x86_64/mpspec.h.
Remove cpumask hack from asm-x86_64/topology.h routine
pcibus_to_cpumask().
Clarify and slightly optimize set_cpus_allowed() cpumask check
in kernel/sched.c
Index: 2.6.6-rc3-mm2-bitmapv5/kernel/sched.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/kernel/sched.c 2004-05-06 03:29:32.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/kernel/sched.c 2004-05-06 03:30:05.000000000 -0700
@@ -3497,7 +3497,7 @@
runqueue_t *rq;
rq = task_rq_lock(p, &flags);
- if (any_online_cpu(new_mask) == NR_CPUS) {
+ if (!cpus_intersects(new_mask, cpu_online_map)) {
ret = -EINVAL;
goto out;
}
Index: 2.6.6-rc3-mm2-bitmapv5/arch/sparc64/kernel/smp.c
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/arch/sparc64/kernel/smp.c 2004-05-06 03:25:41.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/arch/sparc64/kernel/smp.c 2004-05-06 03:30:05.000000000 -0700
@@ -406,14 +406,8 @@
int i;
__asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate));
- for (i = 0; i < NR_CPUS; i++) {
- if (cpu_isset(i, mask)) {
- spitfire_xcall_helper(data0, data1, data2, pstate, i);
- cpu_clear(i, mask);
- if (cpus_empty(mask))
- break;
- }
- }
+ for_each_cpu_mask(i, mask)
+ spitfire_xcall_helper(data0, data1, data2, pstate, i);
}
/* Cheetah now allows to send the whole 64-bytes of data in the interrupt
@@ -456,25 +450,19 @@
nack_busy_id = 0;
{
- cpumask_t work_mask = mask;
int i;
- for (i = 0; i < NR_CPUS; i++) {
- if (cpu_isset(i, work_mask)) {
- u64 target = (i << 14) | 0x70;
-
- if (!is_jalapeno)
- target |= (nack_busy_id << 24);
- __asm__ __volatile__(
- "stxa %%g0, [%0] %1\n\t"
- "membar #Sync\n\t"
- : /* no outputs */
- : "r" (target), "i" (ASI_INTR_W));
- nack_busy_id++;
- cpu_clear(i, work_mask);
- if (cpus_empty(work_mask))
- break;
- }
+ for_each_cpu_mask(i, mask) {
+ u64 target = (i << 14) | 0x70;
+
+ if (!is_jalapeno)
+ target |= (nack_busy_id << 24);
+ __asm__ __volatile__(
+ "stxa %%g0, [%0] %1\n\t"
+ "membar #Sync\n\t"
+ : /* no outputs */
+ : "r" (target), "i" (ASI_INTR_W));
+ nack_busy_id++;
}
}
@@ -507,7 +495,6 @@
printk("CPU[%d]: mondo stuckage result[%016lx]\n",
smp_processor_id(), dispatch_stat);
} else {
- cpumask_t work_mask = mask;
int i, this_busy_nack = 0;
/* Delay some random time with interrupts enabled
@@ -518,22 +505,17 @@
/* Clear out the mask bits for cpus which did not
* NACK us.
*/
- for (i = 0; i < NR_CPUS; i++) {
- if (cpu_isset(i, work_mask)) {
- u64 check_mask;
-
- if (is_jalapeno)
- check_mask = (0x2UL << (2*i));
- else
- check_mask = (0x2UL <<
- this_busy_nack);
- if ((dispatch_stat & check_mask) == 0)
- cpu_clear(i, mask);
- this_busy_nack += 2;
- cpu_clear(i, work_mask);
- if (cpus_empty(work_mask))
- break;
- }
+ for_each_cpu_mask(i, mask) {
+ u64 check_mask;
+
+ if (is_jalapeno)
+ check_mask = (0x2UL << (2*i));
+ else
+ check_mask = (0x2UL <<
+ this_busy_nack);
+ if ((dispatch_stat & check_mask) == 0)
+ cpu_clear(i, mask);
+ this_busy_nack += 2;
}
goto retry;
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-es7000/mach_ipi.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mach-es7000/mach_ipi.h 2004-05-06 03:25:43.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mach-es7000/mach_ipi.h 2004-05-06 03:30:05.000000000 -0700
@@ -10,9 +10,8 @@
static inline void send_IPI_allbutself(int vector)
{
- cpumask_t mask = cpumask_of_cpu(smp_processor_id());
- cpus_complement(mask);
- cpus_and(mask, mask, cpu_online_map);
+ cpumask_t mask = cpu_online_map;
+ cpu_clear(smp_processor_id(), mask);
if (!cpus_empty(mask))
send_IPI_mask(mask, vector);
}
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mpspec.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-i386/mpspec.h 2004-05-06 03:25:44.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-i386/mpspec.h 2004-05-06 03:30:05.000000000 -0700
@@ -53,7 +53,7 @@
#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
-#define physids_complement(map) bitmap_complement((map).mask, (map).mask, MAX_APICS)
+#define physids_complement(dst, src) bitmap_complement((dst).mask,(src).mask, MAX_APICS)
#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/mpspec.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-x86_64/mpspec.h 2004-05-06 03:25:44.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/mpspec.h 2004-05-06 03:30:05.000000000 -0700
@@ -212,7 +212,7 @@
#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
-#define physids_complement(map) bitmap_complement((map).mask, (map).mask, MAX_APICS)
+#define physids_complement(dst, src) bitmap_complement((dst).mask, (src).mask, MAX_APICS)
#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
Index: 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/topology.h
===================================================================
--- 2.6.6-rc3-mm2-bitmapv5.orig/include/asm-x86_64/topology.h 2004-05-06 00:08:12.000000000 -0700
+++ 2.6.6-rc3-mm2-bitmapv5/include/asm-x86_64/topology.h 2004-05-06 03:30:05.000000000 -0700
@@ -20,9 +20,11 @@
#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
#define node_to_cpumask(node) (node_to_cpumask[node])
-static inline unsigned long pcibus_to_cpumask(int bus)
+static inline cpumask_t pcibus_to_cpumask(int bus)
{
- return mp_bus_to_cpumask[bus] & cpu_online_map;
+ cpumask_t tmp;
+ cpus_and(tmp, mp_bus_to_cpumask[bus], cpu_online_map);
+ return tmp;
}
#define NODE_BALANCE_RATE 30 /* CHECKME */
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH mask 0/15] bitmap and cpumask cleanup
2004-05-06 18:18 [PATCH mask 0/15] bitmap and cpumask cleanup Paul Jackson
` (14 preceding siblings ...)
2004-05-06 18:49 ` [PATCH mask 15/15] mask9-post-cleanup-tweaks Paul Jackson
@ 2004-05-07 9:53 ` Paul Jackson
15 siblings, 0 replies; 20+ messages in thread
From: Paul Jackson @ 2004-05-07 9:53 UTC (permalink / raw)
To: Paul Jackson; +Cc: akpm, linux-kernel, colpatch, wli, rusty, joe.korty, jbarnes
Andrew has requested by private email that I hold off for now, and try
resubmitting this patchset after he has "unloaded a few hundred patches
into 2.6.7." Something about too many confusions ...
I will do so, gladly.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 20+ messages in thread