Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35561
b: refs/heads/master
c: 632bbfe
h: refs/heads/master
i:
  35559: 84572bf
v: v3
  • Loading branch information
Jan Blunck authored and Linus Torvalds committed Sep 26, 2006
1 parent 85b8843 commit 25cac7e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0a2966b48fb784e437520e400ddc94874ddbd4e8
refs/heads/master: 632bbfeee4f042c05bc65150b4433a297d3fe387
4 changes: 3 additions & 1 deletion trunk/include/asm-generic/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
__attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name

/* var is in discarded region: offset to particular copy we want */
#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
#define per_cpu(var, cpu) (*({ \
extern int simple_indentifier_##var(void); \
RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); }))
#define __get_cpu_var(var) per_cpu(var, smp_processor_id())
#define __raw_get_cpu_var(var) per_cpu(var, raw_smp_processor_id())

Expand Down
20 changes: 11 additions & 9 deletions trunk/include/asm-s390/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
*/
#if defined(__s390x__) && defined(MODULE)

#define __reloc_hide(var,offset) \
(*({ unsigned long *__ptr; \
asm ( "larl %0,per_cpu__"#var"@GOTENT" \
: "=a" (__ptr) : "X" (per_cpu__##var) ); \
(typeof(&per_cpu__##var))((*__ptr) + (offset)); }))
#define __reloc_hide(var,offset) (*({ \
extern int simple_indentifier_##var(void); \
unsigned long *__ptr; \
asm ( "larl %0,per_cpu__"#var"@GOTENT" \
: "=a" (__ptr) : "X" (per_cpu__##var) ); \
(typeof(&per_cpu__##var))((*__ptr) + (offset)); }))

#else

#define __reloc_hide(var, offset) \
(*({ unsigned long __ptr; \
asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \
(typeof(&per_cpu__##var)) (__ptr + (offset)); }))
#define __reloc_hide(var, offset) (*({ \
extern int simple_indentifier_##var(void); \
unsigned long __ptr; \
asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \
(typeof(&per_cpu__##var)) (__ptr + (offset)); }))

#endif

Expand Down
12 changes: 9 additions & 3 deletions trunk/include/asm-x86_64/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@
__attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name

/* var is in discarded region: offset to particular copy we want */
#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
#define per_cpu(var, cpu) (*({ \
extern int simple_indentifier_##var(void); \
RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)); }))
#define __get_cpu_var(var) (*({ \
extern int simple_indentifier_##var(void); \
RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); }))
#define __raw_get_cpu_var(var) (*({ \
extern int simple_indentifier_##var(void); \
RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); }))

/* A macro to avoid #include hell... */
#define percpu_modcopy(pcpudst, src, size) \
Expand Down
10 changes: 8 additions & 2 deletions trunk/include/linux/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
#define PERCPU_ENOUGH_ROOM 32768
#endif

/* Must be an lvalue. */
#define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); }))
/*
* Must be an lvalue. Since @var must be a simple identifier,
* we force a syntax error here if it isn't.
*/
#define get_cpu_var(var) (*({ \
extern int simple_indentifier_##var(void); \
preempt_disable(); \
&__get_cpu_var(var); }))
#define put_cpu_var(var) preempt_enable()

#ifdef CONFIG_SMP
Expand Down

0 comments on commit 25cac7e

Please sign in to comment.