@@ -276,12 +276,33 @@ do { \
* used.
*/
-#define _this_cpu_generic_read(pcp) \
-({ typeof(pcp) ret__; \
+#define __this_cpu_generic_read_nopreempt(pcp) \
+({ \
+ typeof(pcp) __ret; \
preempt_disable(); \
- ret__ = *this_cpu_ptr(&(pcp)); \
+ __ret = ACCESS_ONCE(*raw_cpu_ptr(&(pcp))); \
preempt_enable(); \
- ret__; \
+ __ret; \
+})
+
+#define __this_cpu_generic_read_noirq(pcp) \
+({ \
+ typeof(pcp) __ret; \
+ unsigned long __flags; \
+ raw_local_irq_save(__flags); \
+ __ret = *raw_cpu_ptr(&(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; \
})
#ifndef this_cpu_read