diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-10-10 11:46:55 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-10-10 11:46:55 +0200 |
commit | af1a34f21150af199f066dfcccbae9830c9429aa (patch) | |
tree | 313267459418f7bba8510df45ce18d4b4133eb1b /include/asm-generic | |
parent | 39208aa7ecb7d9c4e86df782b5693270313cbab1 (diff) | |
parent | c7e2f69d3ed2e56de1f5eaaf37c0f5f91d7adb0a (diff) | |
download | linux-af1a34f21150af199f066dfcccbae9830c9429aa.tar.bz2 |
Merge branch 'locking/urgent' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/percpu.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 0504ef8f3aa3..976f8ac26665 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h @@ -115,15 +115,35 @@ do { \ (__ret); \ }) -#define this_cpu_generic_read(pcp) \ +#define __this_cpu_generic_read_nopreempt(pcp) \ ({ \ typeof(pcp) __ret; \ preempt_disable_notrace(); \ - __ret = raw_cpu_generic_read(pcp); \ + __ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \ preempt_enable_notrace(); \ __ret; \ }) +#define __this_cpu_generic_read_noirq(pcp) \ +({ \ + typeof(pcp) __ret; \ + unsigned long __flags; \ + raw_local_irq_save(__flags); \ + __ret = raw_cpu_generic_read(pcp); \ + raw_local_irq_restore(__flags); \ + __ret; \ +}) + +#define this_cpu_generic_read(pcp) \ +({ \ + typeof(pcp) __ret; \ + if (__native_word(pcp)) \ + __ret = __this_cpu_generic_read_nopreempt(pcp); \ + else \ + __ret = __this_cpu_generic_read_noirq(pcp); \ + __ret; \ +}) + #define this_cpu_generic_to_op(pcp, val, op) \ do { \ unsigned long __flags; \ |