Skip to contentSkip to conversation

rearrange cpumask.h headers in conventional structure

PATCH In review Paul Jackson 2 participants 4 messages Dec 15, 2003 – Dec 16, 2003

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rearrange cpumask.h headers in conventional structure

Andrew,

Please consider the following patch. Perhaps it initially goes into -mm, and then, when 2.6 is in a suitable state, to there.

This patch applies the 'conventional' organization used by all other include/asm-generic headers to the cpumask headers.

No semantic code changes are included - just header file structure changes.

The current cpumask headers are organized in an 'unusual' fashion, which entangles all arch's, and impedes any change for one arch, due to the risk of impacting another.

By the conventional organization, all headers in include/asm-generic are included from other include/asm-* files, or from architecture specific files under arch. There are 245 such inclusions in 2.6 test11, all following this convention.

Exactly 5 inclusions of include/asm-generic files are different, the 5 inclusions of the various include/asm-generic/cpumask_*.h files, all from include/linux/cpumask.h.

The convention for any facility that is partially generic, partially arch specific is for each include/asm-* arch to have it's own arch-specific header file (picked up via the include/asm symlink to the current arch), and for those arch-specific header files in turn to include asm-generic headers, if and to the extend that they choose to make use of the generic implementation.

The following 16 facilities all follow this convention:

    pci.h               pgtable.h         ide.h
    siginfo.h           tlb.h             rtc.h
    div64.h             errno.h           xor.h
    percpu.h            rmap.h            local.h
    statfs.h            topology.h        sections.h

dma-mapping.h

The cpumask facility is different, unjustifiably so, in my view.

The following patch applies the above conventions to the cpumask headers.

1) It changes all users of cpumask, from including linux/cpumask.h, to including asm/cpumask.h

2) It moves the top level cpumask.h from linux to asm-generic

3) It adds an asm-<arch>/cpumask.h file to each arch, that for now simply includes asm-generic/cpumask.h

With this change, the cpumask.h header follows the same conventions as other such features, and individual arch's will be able to provide arch-specific implementations of cpumask, without impacting other arch's.

My primary motivation for this change, besides trying to be a good citizen and clean up unconventional code, is to make it possible for me to provide an improved cpumask for the ia64 arch, without killing the sparc64 implementation.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1496 -> 1.1498
# include/asm-ppc64/smp.h 1.12 -> 1.13
# include/asm-i386/mpspec.h 1.16 -> 1.17
# include/asm-x86_64/smp.h 1.13 -> 1.14
# include/asm-um/smp.h 1.3 -> 1.4
# net/core/flow.c 1.16 -> 1.17
# arch/i386/mach-generic/probe.c 1.2 -> 1.3
# arch/i386/mach-generic/default.c 1.4 -> 1.5
# include/linux/sched.h 1.175 -> 1.176
# arch/ppc64/kernel/open_pic.h 1.2 -> 1.3
# drivers/base/node.c 1.15 -> 1.16
# include/asm-mips/smp.h 1.5 -> 1.6
# include/asm-i386/topology.h 1.7 -> 1.8
# include/asm-ppc/smp.h 1.14 -> 1.15
# include/asm-sparc/smp.h 1.8 -> 1.9
# include/linux/rcupdate.h 1.4 -> 1.5
# arch/i386/mach-generic/bigsmp.c 1.3 -> 1.4
# include/asm-sparc64/smp.h 1.18 -> 1.19
# include/asm-ia64/numa.h 1.11 -> 1.12
# include/linux/cpumask.h 1.1 -> 1.3 include/asm-generic/cpumask.h (moved)
# include/linux/irq.h 1.9 -> 1.10

#	include/asm-ia64/smp.h	1.13    -> 1.14   
#	include/asm-s390/smp.h	1.11    -> 1.12   
#	include/asm-i386/smp.h	1.29    -> 1.30   

# include/linux/topology.h 1.3 -> 1.4
# include/asm-parisc/smp.h 1.5 -> 1.6
# arch/ppc/kernel/irq.c 1.33 -> 1.34
# include/asm-alpha/smp.h 1.12 -> 1.13
# include/linux/node.h 1.5 -> 1.6

#	arch/i386/mach-generic/summit.c	1.3     -> 1.4    
#	               (new)	        -> 1.1     include/asm-s390/cpumask.h
#	               (new)	        -> 1.1     include/asm-m68knommu/cpumask.h
#	               (new)	        -> 1.1     include/asm-sparc64/cpumask.h
#	               (new)	        -> 1.1     include/asm-ia64/cpumask.h
#	               (new)	        -> 1.1     include/asm-arm/cpumask.h
#	               (new)	        -> 1.1     include/asm-h8300/cpumask.h
#	               (new)	        -> 1.1     include/asm-mips/cpumask.h
#	               (new)	        -> 1.1     include/asm-v850/cpumask.h
#	               (new)	        -> 1.1     include/asm-ppc/cpumask.h
#	               (new)	        -> 1.1     include/asm-x86_64/cpumask.h
#	               (new)	        -> 1.1     include/asm-sparc/cpumask.h
#	               (new)	        -> 1.1     include/asm-m68k/cpumask.h
#	               (new)	        -> 1.1     include/asm-ppc64/cpumask.h
#	               (new)	        -> 1.1     include/asm-alpha/cpumask.h
#	               (new)	        -> 1.1     include/asm-arm26/cpumask.h
#	               (new)	        -> 1.1     include/asm-i386/cpumask.h
#	               (new)	        -> 1.1     include/asm-parisc/cpumask.h
#	               (new)	        -> 1.1     include/asm-um/cpumask.h
#	               (new)	        -> 1.1     include/asm-sh/cpumask.h
#	               (new)	        -> 1.1     include/asm-cris/cpumask.h

#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/12/14 [email protected] 1.1497
# Apply conventions used by all other generic headers to cpumask.h:

#  1) Using code should include <asm/cpumask.h> (not linux/cpumask.h)
#  2) Each arch has its own include/asm-<arch>/cpumask.h file
#  3) That arch-specific header file can include <asm-generic/cpumask.h>,
#     if it wants to make use of the generic cpumask implementation.
# Following the conventions used by all other such headers simplifies
# understanding the code, and enables an arch to have its own cpumask
# implementation details without affecting other arch's.
# --------------------------------------------
# 03/12/15	[email protected]	1.1498
# Change cpumask.h ifndef symbol to match new asm-generic location.
# --------------------------------------------
#
diff -Nru a/arch/i386/mach-generic/bigsmp.c b/arch/i386/mach-generic/bigsmp.c
--- a/arch/i386/mach-generic/bigsmp.c	Mon Dec 15 00:04:43 2003
+++ b/arch/i386/mach-generic/bigsmp.c	Mon Dec 15 00:04:43 2003
@@ -5,7 +5,7 @@
 #define APIC_DEFINITION 1
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <asm/mpspec.h>
 #include <asm/genapic.h>
 #include <asm/fixmap.h>
diff -Nru a/arch/i386/mach-generic/default.c b/arch/i386/mach-generic/default.c
--- a/arch/i386/mach-generic/default.c	Mon Dec 15 00:04:43 2003
+++ b/arch/i386/mach-generic/default.c	Mon Dec 15 00:04:43 2003
@@ -4,7 +4,7 @@
 #define APIC_DEFINITION 1
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <asm/mpspec.h>
 #include <asm/mach-default/mach_apicdef.h>
 #include <asm/genapic.h>
diff -Nru a/arch/i386/mach-generic/probe.c b/arch/i386/mach-generic/probe.c
--- a/arch/i386/mach-generic/probe.c	Mon Dec 15 00:04:43 2003
+++ b/arch/i386/mach-generic/probe.c	Mon Dec 15 00:04:43 2003
@@ -5,7 +5,7 @@
  */  
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
diff -Nru a/arch/i386/mach-generic/summit.c b/arch/i386/mach-generic/summit.c
--- a/arch/i386/mach-generic/summit.c	Mon Dec 15 00:04:43 2003
+++ b/arch/i386/mach-generic/summit.c	Mon Dec 15 00:04:43 2003
@@ -4,7 +4,7 @@
 #define APIC_DEFINITION 1
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <asm/mpspec.h>
 #include <asm/genapic.h>
 #include <asm/fixmap.h>
diff -Nru a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c
--- a/arch/ppc/kernel/irq.c	Mon Dec 15 00:04:43 2003
+++ b/arch/ppc/kernel/irq.c	Mon Dec 15 00:04:43 2003
@@ -45,7 +45,7 @@
 #include <linux/proc_fs.h>
 #include <linux/random.h>
 #include <linux/seq_file.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>

#include <asm/uaccess.h>
#include <asm/bitops.h>

arch/ppc64/kernel/open_pic.h +1 -1
diff -Nru a/arch/ppc64/kernel/open_pic.h b/arch/ppc64/kernel/open_pic.h
@@ -13,7 +13,7 @@
 #define _PPC64_KERNEL_OPEN_PIC_H
 
 #include <linux/config.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 #define OPENPIC_SIZE	0x40000
 
drivers/base/node.c +1 -1
diff -Nru a/drivers/base/node.c b/drivers/base/node.c
@@ -7,7 +7,7 @@
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/node.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/topology.h>
 
 static struct sysdev_class node_class = {
include/asm-alpha/cpumask.h new file +6 -0
diff -Nru a/include/asm-alpha/cpumask.h b/include/asm-alpha/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_ALPHA_CPUMASK_H
+#define _ASM_ALPHA_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_ALPHA_CPUMASK_H */
include/asm-alpha/smp.h +1 -1
diff -Nru a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h
@@ -3,7 +3,7 @@
 
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/bitops.h>
 #include <asm/pal.h>
 
include/asm-arm/cpumask.h new file +6 -0
diff -Nru a/include/asm-arm/cpumask.h b/include/asm-arm/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_ARM_CPUMASK_H
+#define _ASM_ARM_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_ARM_CPUMASK_H */
include/asm-arm26/cpumask.h new file +6 -0
diff -Nru a/include/asm-arm26/cpumask.h b/include/asm-arm26/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_ARM26_CPUMASK_H
+#define _ASM_ARM26_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_ARM26_CPUMASK_H */
include/asm-cris/cpumask.h new file +6 -0
diff -Nru a/include/asm-cris/cpumask.h b/include/asm-cris/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_CRIS_CPUMASK_H
+#define _ASM_CRIS_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_CRIS_CPUMASK_H */
include/asm-generic/cpumask.h new file +71 -0

71 lines not on this page · raw message

include/asm-h8300/cpumask.h new file +6 -0
diff -Nru a/include/asm-h8300/cpumask.h b/include/asm-h8300/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_H8300_CPUMASK_H
+#define _ASM_H8300_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_H8300_CPUMASK_H */
include/asm-i386/cpumask.h new file +6 -0
diff -Nru a/include/asm-i386/cpumask.h b/include/asm-i386/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_I386_CPUMASK_H
+#define _ASM_I386_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_I386_CPUMASK_H */
include/asm-i386/mpspec.h +1 -1
diff -Nru a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h
@@ -1,7 +1,7 @@
 #ifndef __ASM_MPSPEC_H
 #define __ASM_MPSPEC_H
 
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <asm/mpspec_def.h>
 #include <mach_mpspec.h>
 
include/asm-i386/smp.h +1 -1
diff -Nru a/include/asm-i386/smp.h b/include/asm-i386/smp.h
@@ -8,7 +8,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #endif
 
 #ifdef CONFIG_X86_LOCAL_APIC
include/asm-i386/topology.h +1 -1
diff -Nru a/include/asm-i386/topology.h b/include/asm-i386/topology.h
@@ -31,7 +31,7 @@
 
 #include <asm/mpspec.h>
 
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 /* Mappings between logical cpu number and node number */
 extern cpumask_t node_2_cpu_mask[];
include/asm-ia64/cpumask.h new file +6 -0
diff -Nru a/include/asm-ia64/cpumask.h b/include/asm-ia64/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_IA64_CPUMASK_H
+#define _ASM_IA64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_IA64_CPUMASK_H */
include/asm-ia64/numa.h +1 -1
diff -Nru a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
@@ -17,7 +17,7 @@
 
 #include <linux/cache.h>
 #include <linux/cache.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/numa.h>
 #include <linux/smp.h>
 #include <linux/threads.h>
include/asm-ia64/smp.h +1 -1
diff -Nru a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
@@ -16,7 +16,7 @@
 #include <linux/init.h>
 #include <linux/threads.h>
 #include <linux/kernel.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 #include <asm/bitops.h>
 #include <asm/io.h>
include/asm-m68k/cpumask.h new file +6 -0
diff -Nru a/include/asm-m68k/cpumask.h b/include/asm-m68k/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_M68K_CPUMASK_H
+#define _ASM_M68K_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_M68K_CPUMASK_H */
include/asm-m68knommu/cpumask.h new file +6 -0
diff -Nru a/include/asm-m68knommu/cpumask.h b/include/asm-m68knommu/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_M68KNOMMU_CPUMASK_H
+#define _ASM_M68KNOMMU_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_M68KNOMMU_CPUMASK_H */
include/asm-mips/cpumask.h new file +6 -0
diff -Nru a/include/asm-mips/cpumask.h b/include/asm-mips/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_MIPS_CPUMASK_H
+#define _ASM_MIPS_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_MIPS_CPUMASK_H */
include/asm-mips/smp.h +1 -1
diff -Nru a/include/asm-mips/smp.h b/include/asm-mips/smp.h
@@ -17,7 +17,7 @@
 
 #include <linux/bitops.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <asm/atomic.h>
 
 #define smp_processor_id()	(current_thread_info()->cpu)
include/asm-parisc/cpumask.h new file +6 -0
diff -Nru a/include/asm-parisc/cpumask.h b/include/asm-parisc/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_PARISC_CPUMASK_H
+#define _ASM_PARISC_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_PARISC_CPUMASK_H */
include/asm-parisc/smp.h +1 -1
diff -Nru a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h
@@ -14,7 +14,7 @@
 #ifndef ASSEMBLY
 #include <linux/bitops.h>
 #include <linux/threads.h>	/* for NR_CPUS */
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 typedef unsigned long address_t;
 
 extern cpumask_t cpu_online_map;
include/asm-ppc/cpumask.h new file +6 -0
diff -Nru a/include/asm-ppc/cpumask.h b/include/asm-ppc/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_PPC_CPUMASK_H
+#define _ASM_PPC_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_PPC_CPUMASK_H */
include/asm-ppc/smp.h +1 -1
diff -Nru a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h
@@ -14,7 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/bitops.h>
 #include <linux/errno.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/threads.h>
 
 #ifdef CONFIG_SMP
include/asm-ppc64/cpumask.h new file +6 -0
diff -Nru a/include/asm-ppc64/cpumask.h b/include/asm-ppc64/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_PPC64_CPUMASK_H
+#define _ASM_PPC64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_PPC64_CPUMASK_H */
include/asm-ppc64/smp.h +1 -1
diff -Nru a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h
@@ -19,7 +19,7 @@
 
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/kernel.h>
 
 #ifdef CONFIG_SMP
include/asm-s390/cpumask.h new file +6 -0
diff -Nru a/include/asm-s390/cpumask.h b/include/asm-s390/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_S390_CPUMASK_H
+#define _ASM_S390_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_S390_CPUMASK_H */
include/asm-s390/smp.h +1 -1
diff -Nru a/include/asm-s390/smp.h b/include/asm-s390/smp.h
@@ -11,7 +11,7 @@
 
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/bitops.h>
 
 #if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
include/asm-sh/cpumask.h new file +6 -0
diff -Nru a/include/asm-sh/cpumask.h b/include/asm-sh/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_SH_CPUMASK_H
+#define _ASM_SH_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_SH_CPUMASK_H */
include/asm-sparc/cpumask.h new file +6 -0
diff -Nru a/include/asm-sparc/cpumask.h b/include/asm-sparc/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_SPARC_CPUMASK_H
+#define _ASM_SPARC_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_SPARC_CPUMASK_H */
include/asm-sparc/smp.h +1 -1
diff -Nru a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
@@ -13,7 +13,7 @@
 
 #ifndef __ASSEMBLY__
 
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 /* PROM provided per-processor information we need
  * to start them all up.
include/asm-sparc64/cpumask.h new file +6 -0
diff -Nru a/include/asm-sparc64/cpumask.h b/include/asm-sparc64/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_SPARC64_CPUMASK_H
+#define _ASM_SPARC64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_SPARC64_CPUMASK_H */
include/asm-sparc64/smp.h +1 -1
diff -Nru a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
@@ -14,7 +14,7 @@
 
 #ifndef __ASSEMBLY__
 
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/cache.h>
 
 #endif /* !(__ASSEMBLY__) */
include/asm-um/cpumask.h new file +6 -0
diff -Nru a/include/asm-um/cpumask.h b/include/asm-um/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_UM_CPUMASK_H
+#define _ASM_UM_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_UM_CPUMASK_H */
include/asm-um/smp.h +1 -1
diff -Nru a/include/asm-um/smp.h b/include/asm-um/smp.h
@@ -6,7 +6,7 @@
 #include "linux/config.h"
 #include "linux/bitops.h"
 #include "asm/current.h"
-#include "linux/cpumask.h"
+#include "asm/cpumask.h"
 
 extern cpumask_t cpu_online_map;
 
include/asm-v850/cpumask.h new file +6 -0
diff -Nru a/include/asm-v850/cpumask.h b/include/asm-v850/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_V850_CPUMASK_H
+#define _ASM_V850_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_V850_CPUMASK_H */
include/asm-x86_64/cpumask.h new file +6 -0
diff -Nru a/include/asm-x86_64/cpumask.h b/include/asm-x86_64/cpumask.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_X86_64_CPUMASK_H
+#define _ASM_X86_64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_X86_64_CPUMASK_H */
include/asm-x86_64/smp.h +1 -1
diff -Nru a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
@@ -7,7 +7,7 @@
 #ifndef __ASSEMBLY__
 #include <linux/config.h>
 #include <linux/threads.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/bitops.h>
 extern int disable_apic;
 #endif
include/linux/cpumask.h deleted +0 -71

71 lines not on this page · raw message

include/linux/irq.h +1 -1
diff -Nru a/include/linux/irq.h b/include/linux/irq.h
@@ -15,7 +15,7 @@
 
 #include <linux/cache.h>
 #include <linux/spinlock.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 #include <asm/irq.h>
 #include <asm/ptrace.h>
include/linux/node.h +1 -1
diff -Nru a/include/linux/node.h b/include/linux/node.h
@@ -20,7 +20,7 @@
 #define _LINUX_NODE_H_
 
 #include <linux/sysdev.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 struct node {
 	cpumask_t cpumap;	/* Bitmap of CPUs on the Node */
include/linux/rcupdate.h +1 -1
diff -Nru a/include/linux/rcupdate.h b/include/linux/rcupdate.h
@@ -40,7 +40,7 @@
 #include <linux/spinlock.h>
 #include <linux/threads.h>
 #include <linux/percpu.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 /**
  * struct rcu_head - callback structure for use with RCU
include/linux/sched.h +1 -1
diff -Nru a/include/linux/sched.h b/include/linux/sched.h
@@ -12,7 +12,7 @@
 #include <linux/jiffies.h>
 #include <linux/rbtree.h>
 #include <linux/thread_info.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 
 #include <asm/system.h>
 #include <asm/semaphore.h>
include/linux/topology.h +1 -1
diff -Nru a/include/linux/topology.h b/include/linux/topology.h
@@ -27,7 +27,7 @@
 #ifndef _LINUX_TOPOLOGY_H
 #define _LINUX_TOPOLOGY_H
 
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <linux/bitops.h>
 #include <linux/mmzone.h>
 #include <linux/smp.h>
net/core/flow.c +1 -1
diff -Nru a/net/core/flow.c b/net/core/flow.c
@@ -19,7 +19,7 @@
 #include <linux/bitops.h>
 #include <linux/notifier.h>
 #include <linux/cpu.h>
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>
 #include <net/flow.h>
 #include <asm/atomic.h>
 #include <asm/semaphore.h>
Signature · 3 lines
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <[email protected]> 1.650.933.1373
#1 lore raw
Quoted 10 lines · Paul Jackson

...
The convention for any facility that is partially generic,
partially arch specific is for each include/asm-* arch to have it's own arch-specific header file (picked up via the include/asm symlink to the current arch), and for those arch-specific header files in turn to include asm-generic headers, if and to the extend that they choose to make use of the generic implementation.

Quoted 3 lines

...
-#include <linux/cpumask.h>
+#include <asm/cpumask.h>

Personally, I rather prefer that include/linux/cpumask.h be retained, and that it perform the inclusion of <asm/cpumask.h>. This provides some level of information hiding and gives us somewhere to place cpumask things which we _know_ are arch-independent.

#2 lore raw
Quoted 2 lines

Personally, I rather prefer that include/linux/cpumask.h be retained, and that it perform the inclusion of <asm/cpumask.h>.

Good idea. Should have thought of it myself ;).

I'll come up with another patch - probably tomorrow.

Thanks.

Signature · 3 lines
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <[email protected]> 1.650.933.1373
#3 lore raw

PATCH 1/1 Take 2: rearrange cpumask.h headers in conventional structure

In reply to Andrew Morton

Andrew,

Please consider the following patch for inclusion. It applies to test11.

==

Here is my second version of the patch to rearrange the cpumask headers. Following Andrew's suggestion, include/linux/cpumask.h is retained, and contains arch-independent cpumask things. The using files are no longer changed from including linux/cpumask.h to including asm/cpumask.h

See my original post in this thread for further explanation of the motivations for this change.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1496 -> 1.1497
# include/linux/cpumask.h 1.1 -> 1.3 include/asm-generic/cpumask.h (moved)

#	               (new)	        -> 1.2     include/linux/cpumask.h
#	               (new)	        -> 1.1     include/asm-m68knommu/cpumask.h
#	               (new)	        -> 1.1     include/asm-um/cpumask.h
#	               (new)	        -> 1.1     include/asm-cris/cpumask.h
#	               (new)	        -> 1.1     include/asm-s390/cpumask.h
#	               (new)	        -> 1.1     include/asm-arm26/cpumask.h
#	               (new)	        -> 1.1     include/asm-v850/cpumask.h
#	               (new)	        -> 1.1     include/asm-mips/cpumask.h
#	               (new)	        -> 1.1     include/asm-sh/cpumask.h
#	               (new)	        -> 1.1     include/asm-arm/cpumask.h
#	               (new)	        -> 1.1     include/asm-alpha/cpumask.h
#	               (new)	        -> 1.1     include/asm-h8300/cpumask.h
#	               (new)	        -> 1.1     include/asm-x86_64/cpumask.h
#	               (new)	        -> 1.1     include/asm-ppc/cpumask.h
#	               (new)	        -> 1.1     include/asm-parisc/cpumask.h
#	               (new)	        -> 1.1     include/asm-i386/cpumask.h
#	               (new)	        -> 1.1     include/asm-sparc64/cpumask.h
#	               (new)	        -> 1.1     include/asm-m68k/cpumask.h
#	               (new)	        -> 1.1     include/asm-sparc/cpumask.h
#	               (new)	        -> 1.1     include/asm-ppc64/cpumask.h
#	               (new)	        -> 1.1     include/asm-ia64/cpumask.h

#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/12/16 [email protected] 1.1497
# Apply conventions used by all other generic headers to cpumask.h:
# 1) Each arch has its own include/asm-<arch>/cpumask.h file # 2) That arch-specific header file can include <asm-generic/cpumask.h>,
# if it wants to make use of the generic cpumask implementation.
# 3) Using code should continue to include linux/cpumask.h, which

#     in turn includes asm/cpumask.h.  Some common implementation
#     independent cpumask related items, such as the cpu_online_map,
#     are declared directly in linux/cpumask.h.
# Following the conventions used by all other such headers simplifies
# understanding the code, and enables an arch to have its own cpumask
# implementation details without affecting other arch's.
# --------------------------------------------
#
diff -Nru a/include/asm-alpha/cpumask.h b/include/asm-alpha/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-alpha/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_ALPHA_CPUMASK_H
+#define _ASM_ALPHA_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_ALPHA_CPUMASK_H */
diff -Nru a/include/asm-arm/cpumask.h b/include/asm-arm/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_ARM_CPUMASK_H
+#define _ASM_ARM_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_ARM_CPUMASK_H */
diff -Nru a/include/asm-arm26/cpumask.h b/include/asm-arm26/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm26/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_ARM26_CPUMASK_H
+#define _ASM_ARM26_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_ARM26_CPUMASK_H */
diff -Nru a/include/asm-cris/cpumask.h b/include/asm-cris/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-cris/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_CRIS_CPUMASK_H
+#define _ASM_CRIS_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_CRIS_CPUMASK_H */
diff -Nru a/include/asm-generic/cpumask.h b/include/asm-generic/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-generic/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,40 @@
+#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 */
diff -Nru a/include/asm-h8300/cpumask.h b/include/asm-h8300/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-h8300/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_H8300_CPUMASK_H
+#define _ASM_H8300_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_H8300_CPUMASK_H */
diff -Nru a/include/asm-i386/cpumask.h b/include/asm-i386/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_I386_CPUMASK_H
+#define _ASM_I386_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_I386_CPUMASK_H */
diff -Nru a/include/asm-ia64/cpumask.h b/include/asm-ia64/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-ia64/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_IA64_CPUMASK_H
+#define _ASM_IA64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_IA64_CPUMASK_H */
diff -Nru a/include/asm-m68k/cpumask.h b/include/asm-m68k/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-m68k/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_M68K_CPUMASK_H
+#define _ASM_M68K_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_M68K_CPUMASK_H */
diff -Nru a/include/asm-m68knommu/cpumask.h b/include/asm-m68knommu/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-m68knommu/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_M68KNOMMU_CPUMASK_H
+#define _ASM_M68KNOMMU_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_M68KNOMMU_CPUMASK_H */
diff -Nru a/include/asm-mips/cpumask.h b/include/asm-mips/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-mips/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_MIPS_CPUMASK_H
+#define _ASM_MIPS_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_MIPS_CPUMASK_H */
diff -Nru a/include/asm-parisc/cpumask.h b/include/asm-parisc/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-parisc/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_PARISC_CPUMASK_H
+#define _ASM_PARISC_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_PARISC_CPUMASK_H */
diff -Nru a/include/asm-ppc/cpumask.h b/include/asm-ppc/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-ppc/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_PPC_CPUMASK_H
+#define _ASM_PPC_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_PPC_CPUMASK_H */
diff -Nru a/include/asm-ppc64/cpumask.h b/include/asm-ppc64/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-ppc64/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_PPC64_CPUMASK_H
+#define _ASM_PPC64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_PPC64_CPUMASK_H */
diff -Nru a/include/asm-s390/cpumask.h b/include/asm-s390/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-s390/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_S390_CPUMASK_H
+#define _ASM_S390_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_S390_CPUMASK_H */
diff -Nru a/include/asm-sh/cpumask.h b/include/asm-sh/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-sh/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_SH_CPUMASK_H
+#define _ASM_SH_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_SH_CPUMASK_H */
diff -Nru a/include/asm-sparc/cpumask.h b/include/asm-sparc/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-sparc/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_SPARC_CPUMASK_H
+#define _ASM_SPARC_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_SPARC_CPUMASK_H */
diff -Nru a/include/asm-sparc64/cpumask.h b/include/asm-sparc64/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-sparc64/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_SPARC64_CPUMASK_H
+#define _ASM_SPARC64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_SPARC64_CPUMASK_H */
diff -Nru a/include/asm-um/cpumask.h b/include/asm-um/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-um/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_UM_CPUMASK_H
+#define _ASM_UM_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_UM_CPUMASK_H */
diff -Nru a/include/asm-v850/cpumask.h b/include/asm-v850/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-v850/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_V850_CPUMASK_H
+#define _ASM_V850_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_V850_CPUMASK_H */
diff -Nru a/include/asm-x86_64/cpumask.h b/include/asm-x86_64/cpumask.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-x86_64/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -0,0 +1,6 @@
+#ifndef _ASM_X86_64_CPUMASK_H
+#define _ASM_X86_64_CPUMASK_H
+
+#include <asm-generic/cpumask.h>
+
+#endif /* _ASM_X86_64_CPUMASK_H */
diff -Nru a/include/linux/cpumask.h b/include/linux/cpumask.h
--- a/include/linux/cpumask.h	Tue Dec 16 03:09:14 2003
+++ b/include/linux/cpumask.h	Tue Dec 16 03:09:14 2003
@@ -1,42 +1,9 @@
 #ifndef __LINUX_CPUMASK_H
 #define __LINUX_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
-
+#include <asm/cpumask.h>
+#include <asm/bug.h>

#ifdef CONFIG_SMP

Signature · 3 lines
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <[email protected]> 1.650.933.1373