diff options
Diffstat (limited to 'include/linux/highmem.h')
-rw-r--r-- | include/linux/highmem.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index e9138198e823..3a93f73a8acc 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
7 | #include <linux/uaccess.h> | 7 | #include <linux/uaccess.h> |
8 | #include <linux/hardirq.h> | ||
8 | 9 | ||
9 | #include <asm/cacheflush.h> | 10 | #include <asm/cacheflush.h> |
10 | 11 | ||
@@ -80,7 +81,8 @@ DECLARE_PER_CPU(int, __kmap_atomic_idx); | |||
80 | 81 | ||
81 | static inline int kmap_atomic_idx_push(void) | 82 | static inline int kmap_atomic_idx_push(void) |
82 | { | 83 | { |
83 | int idx = __get_cpu_var(__kmap_atomic_idx)++; | 84 | int idx = __this_cpu_inc_return(__kmap_atomic_idx) - 1; |
85 | |||
84 | #ifdef CONFIG_DEBUG_HIGHMEM | 86 | #ifdef CONFIG_DEBUG_HIGHMEM |
85 | WARN_ON_ONCE(in_irq() && !irqs_disabled()); | 87 | WARN_ON_ONCE(in_irq() && !irqs_disabled()); |
86 | BUG_ON(idx > KM_TYPE_NR); | 88 | BUG_ON(idx > KM_TYPE_NR); |
@@ -90,16 +92,18 @@ static inline int kmap_atomic_idx_push(void) | |||
90 | 92 | ||
91 | static inline int kmap_atomic_idx(void) | 93 | static inline int kmap_atomic_idx(void) |
92 | { | 94 | { |
93 | return __get_cpu_var(__kmap_atomic_idx) - 1; | 95 | return __this_cpu_read(__kmap_atomic_idx) - 1; |
94 | } | 96 | } |
95 | 97 | ||
96 | static inline int kmap_atomic_idx_pop(void) | 98 | static inline void kmap_atomic_idx_pop(void) |
97 | { | 99 | { |
98 | int idx = --__get_cpu_var(__kmap_atomic_idx); | ||
99 | #ifdef CONFIG_DEBUG_HIGHMEM | 100 | #ifdef CONFIG_DEBUG_HIGHMEM |
101 | int idx = __this_cpu_dec_return(__kmap_atomic_idx); | ||
102 | |||
100 | BUG_ON(idx < 0); | 103 | BUG_ON(idx < 0); |
104 | #else | ||
105 | __this_cpu_dec(__kmap_atomic_idx); | ||
101 | #endif | 106 | #endif |
102 | return idx; | ||
103 | } | 107 | } |
104 | 108 | ||
105 | #endif | 109 | #endif |