Re: [PATCH] fix vmstat per cpu usage

Jan Blunck
2006-08-02T09:01:24Z

On Tue, Aug 01, Andrew Morton wrote:

> >
> > static inline void __count_vm_event(enum vm_event_item item)
> > {
> > - __get_cpu_var(vm_event_states.event[item])++;
> > + __get_cpu_var(vm_event_states).event[item]++;
> > }
>
> How odd. Are there any negative consequences to the existing code?

In asm-s390/percpu.h we use

#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)

and for modules on s390x __reloc_hide() is defined as

#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)); }))

which leads in this case to

larl %0, per_cpu__vm_event_states.event[item]@GOTENT

which is invalid asm.