aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/highmem.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index b676c585574e..3a93f73a8acc 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -81,7 +81,8 @@ DECLARE_PER_CPU(int, __kmap_atomic_idx);
81 81
82static inline int kmap_atomic_idx_push(void) 82static inline int kmap_atomic_idx_push(void)
83{ 83{
84 int idx = __get_cpu_var(__kmap_atomic_idx)++; 84 int idx = __this_cpu_inc_return(__kmap_atomic_idx) - 1;
85
85#ifdef CONFIG_DEBUG_HIGHMEM 86#ifdef CONFIG_DEBUG_HIGHMEM
86 WARN_ON_ONCE(in_irq() && !irqs_disabled()); 87 WARN_ON_ONCE(in_irq() && !irqs_disabled());
87 BUG_ON(idx > KM_TYPE_NR); 88 BUG_ON(idx > KM_TYPE_NR);
@@ -91,16 +92,18 @@ static inline int kmap_atomic_idx_push(void)
91 92
92static inline int kmap_atomic_idx(void) 93static inline int kmap_atomic_idx(void)
93{ 94{
94 return __get_cpu_var(__kmap_atomic_idx) - 1; 95 return __this_cpu_read(__kmap_atomic_idx) - 1;
95} 96}
96 97
97static inline int kmap_atomic_idx_pop(void) 98static inline void kmap_atomic_idx_pop(void)
98{ 99{
99 int idx = --__get_cpu_var(__kmap_atomic_idx);
100#ifdef CONFIG_DEBUG_HIGHMEM 100#ifdef CONFIG_DEBUG_HIGHMEM
101 int idx = __this_cpu_dec_return(__kmap_atomic_idx);
102
101 BUG_ON(idx < 0); 103 BUG_ON(idx < 0);
104#else
105 __this_cpu_dec(__kmap_atomic_idx);
102#endif 106#endif
103 return idx;
104} 107}
105 108
106#endif 109#endif