aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/tlbflush.h1
-rw-r--r--include/asm-ia64/percpu.h35
-rw-r--r--include/asm-powerpc/percpu.h31
-rw-r--r--include/asm-s390/percpu.h42
-rw-r--r--include/asm-sparc64/percpu.h22
-rw-r--r--include/asm-x86/thread_info_64.h4
-rw-r--r--include/linux/percpu.h4
7 files changed, 29 insertions, 110 deletions
diff --git a/include/asm-alpha/tlbflush.h b/include/asm-alpha/tlbflush.h
index eefab3fb51ae..b9e9147226f7 100644
--- a/include/asm-alpha/tlbflush.h
+++ b/include/asm-alpha/tlbflush.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/compiler.h> 5#include <asm/compiler.h>
6#include <asm/pgalloc.h>
6 7
7#ifndef __EXTERN_INLINE 8#ifndef __EXTERN_INLINE
8#define __EXTERN_INLINE extern inline 9#define __EXTERN_INLINE extern inline
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
index 0095bcf79848..77f30b664b4e 100644
--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -15,38 +15,20 @@
15 15
16#include <linux/threads.h> 16#include <linux/threads.h>
17 17
18#ifdef CONFIG_SMP
19
18#ifdef HAVE_MODEL_SMALL_ATTRIBUTE 20#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
19# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__))) 21# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
20#endif 22#endif
21 23
22#define DECLARE_PER_CPU(type, name) \ 24#define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
23 extern PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
24
25/*
26 * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an
27 * external routine, to avoid include-hell.
28 */
29#ifdef CONFIG_SMP
30
31extern unsigned long __per_cpu_offset[NR_CPUS];
32#define per_cpu_offset(x) (__per_cpu_offset[x])
33
34/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
35DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
36 25
37#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
38#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
39#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
40
41extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
42extern void setup_per_cpu_areas (void);
43extern void *per_cpu_init(void); 26extern void *per_cpu_init(void);
44 27
45#else /* ! SMP */ 28#else /* ! SMP */
46 29
47#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) 30#define PER_CPU_ATTRIBUTES __attribute__((__section__(".data.percpu")))
48#define __get_cpu_var(var) per_cpu__##var 31
49#define __raw_get_cpu_var(var) per_cpu__##var
50#define per_cpu_init() (__phys_per_cpu_start) 32#define per_cpu_init() (__phys_per_cpu_start)
51 33
52#endif /* SMP */ 34#endif /* SMP */
@@ -57,7 +39,12 @@ extern void *per_cpu_init(void);
57 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly 39 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
58 * more efficient. 40 * more efficient.
59 */ 41 */
60#define __ia64_per_cpu_var(var) (per_cpu__##var) 42#define __ia64_per_cpu_var(var) per_cpu__##var
43
44#include <asm-generic/percpu.h>
45
46/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
47DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
61 48
62#endif /* !__ASSEMBLY__ */ 49#endif /* !__ASSEMBLY__ */
63 50
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index cc1cbf656b02..ccb0523eb3b4 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -13,37 +13,12 @@
13#include <asm/paca.h> 13#include <asm/paca.h>
14 14
15#define __per_cpu_offset(cpu) (paca[cpu].data_offset) 15#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
16#define __my_cpu_offset() get_paca()->data_offset 16#define __my_cpu_offset get_paca()->data_offset
17#define per_cpu_offset(x) (__per_cpu_offset(x)) 17#define per_cpu_offset(x) (__per_cpu_offset(x))
18 18
19/* var is in discarded region: offset to particular copy we want */ 19#endif /* CONFIG_SMP */
20#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 20#endif /* __powerpc64__ */
21#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
22#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, local_paca->data_offset))
23 21
24/* A macro to avoid #include hell... */
25#define percpu_modcopy(pcpudst, src, size) \
26do { \
27 unsigned int __i; \
28 for_each_possible_cpu(__i) \
29 memcpy((pcpudst)+__per_cpu_offset(__i), \
30 (src), (size)); \
31} while (0)
32
33extern void setup_per_cpu_areas(void);
34
35#else /* ! SMP */
36
37#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
38#define __get_cpu_var(var) per_cpu__##var
39#define __raw_get_cpu_var(var) per_cpu__##var
40
41#endif /* SMP */
42
43#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
44
45#else
46#include <asm-generic/percpu.h> 22#include <asm-generic/percpu.h>
47#endif
48 23
49#endif /* _ASM_POWERPC_PERCPU_H_ */ 24#endif /* _ASM_POWERPC_PERCPU_H_ */
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 2d676a873858..408d60b4f75b 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -13,49 +13,25 @@
13 */ 13 */
14#if defined(__s390x__) && defined(MODULE) 14#if defined(__s390x__) && defined(MODULE)
15 15
16#define __reloc_hide(var,offset) (*({ \ 16#define SHIFT_PERCPU_PTR(ptr,offset) (({ \
17 extern int simple_identifier_##var(void); \ 17 extern int simple_identifier_##var(void); \
18 unsigned long *__ptr; \ 18 unsigned long *__ptr; \
19 asm ( "larl %0,per_cpu__"#var"@GOTENT" \ 19 asm ( "larl %0, %1@GOTENT" \
20 : "=a" (__ptr) : "X" (per_cpu__##var) ); \ 20 : "=a" (__ptr) : "X" (ptr) ); \
21 (typeof(&per_cpu__##var))((*__ptr) + (offset)); })) 21 (typeof(ptr))((*__ptr) + (offset)); }))
22 22
23#else 23#else
24 24
25#define __reloc_hide(var, offset) (*({ \ 25#define SHIFT_PERCPU_PTR(ptr, offset) (({ \
26 extern int simple_identifier_##var(void); \ 26 extern int simple_identifier_##var(void); \
27 unsigned long __ptr; \ 27 unsigned long __ptr; \
28 asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \ 28 asm ( "" : "=a" (__ptr) : "0" (ptr) ); \
29 (typeof(&per_cpu__##var)) (__ptr + (offset)); })) 29 (typeof(ptr)) (__ptr + (offset)); }))
30 30
31#endif 31#endif
32 32
33#ifdef CONFIG_SMP 33#define __my_cpu_offset S390_lowcore.percpu_offset
34 34
35extern unsigned long __per_cpu_offset[NR_CPUS]; 35#include <asm-generic/percpu.h>
36
37#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
38#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
39#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
40#define per_cpu_offset(x) (__per_cpu_offset[x])
41
42/* A macro to avoid #include hell... */
43#define percpu_modcopy(pcpudst, src, size) \
44do { \
45 unsigned int __i; \
46 for_each_possible_cpu(__i) \
47 memcpy((pcpudst)+__per_cpu_offset[__i], \
48 (src), (size)); \
49} while (0)
50
51#else /* ! SMP */
52
53#define __get_cpu_var(var) __reloc_hide(var,0)
54#define __raw_get_cpu_var(var) __reloc_hide(var,0)
55#define per_cpu(var,cpu) __reloc_hide(var,0)
56
57#endif /* SMP */
58
59#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
60 36
61#endif /* __ARCH_S390_PERCPU__ */ 37#endif /* __ARCH_S390_PERCPU__ */
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index c7e52decba98..bee64593023e 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -7,7 +7,6 @@ register unsigned long __local_per_cpu_offset asm("g5");
7 7
8#ifdef CONFIG_SMP 8#ifdef CONFIG_SMP
9 9
10#define setup_per_cpu_areas() do { } while (0)
11extern void real_setup_per_cpu_areas(void); 10extern void real_setup_per_cpu_areas(void);
12 11
13extern unsigned long __per_cpu_base; 12extern unsigned long __per_cpu_base;
@@ -16,29 +15,14 @@ extern unsigned long __per_cpu_shift;
16 (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift)) 15 (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift))
17#define per_cpu_offset(x) (__per_cpu_offset(x)) 16#define per_cpu_offset(x) (__per_cpu_offset(x))
18 17
19/* var is in discarded region: offset to particular copy we want */ 18#define __my_cpu_offset __local_per_cpu_offset
20#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 19
21#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
22#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
23
24/* A macro to avoid #include hell... */
25#define percpu_modcopy(pcpudst, src, size) \
26do { \
27 unsigned int __i; \
28 for_each_possible_cpu(__i) \
29 memcpy((pcpudst)+__per_cpu_offset(__i), \
30 (src), (size)); \
31} while (0)
32#else /* ! SMP */ 20#else /* ! SMP */
33 21
34#define real_setup_per_cpu_areas() do { } while (0) 22#define real_setup_per_cpu_areas() do { } while (0)
35 23
36#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
37#define __get_cpu_var(var) per_cpu__##var
38#define __raw_get_cpu_var(var) per_cpu__##var
39
40#endif /* SMP */ 24#endif /* SMP */
41 25
42#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name 26#include <asm-generic/percpu.h>
43 27
44#endif /* __ARCH_SPARC64_PERCPU__ */ 28#endif /* __ARCH_SPARC64_PERCPU__ */
diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h
index 9b531ea015a8..6c9b214b8fc3 100644
--- a/include/asm-x86/thread_info_64.h
+++ b/include/asm-x86/thread_info_64.h
@@ -123,8 +123,8 @@ static inline struct thread_info *stack_thread_info(void)
123#define TIF_FREEZE 23 /* is freezing for suspend */ 123#define TIF_FREEZE 23 /* is freezing for suspend */
124#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ 124#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */
125#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */ 125#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */
126#define TIF_DS_AREA_MSR 25 /* uses thread_struct.ds_area_msr */ 126#define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */
127#define TIF_BTS_TRACE_TS 26 /* record scheduling event timestamps */ 127#define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */
128 128
129#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 129#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
130#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 130#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 00412bb494c4..50faa0ea28e4 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -9,10 +9,6 @@
9 9
10#include <asm/percpu.h> 10#include <asm/percpu.h>
11 11
12#ifndef PER_CPU_ATTRIBUTES
13#define PER_CPU_ATTRIBUTES
14#endif
15
16#ifdef CONFIG_SMP 12#ifdef CONFIG_SMP
17#define DEFINE_PER_CPU(type, name) \ 13#define DEFINE_PER_CPU(type, name) \
18 __attribute__((__section__(".data.percpu"))) \ 14 __attribute__((__section__(".data.percpu"))) \