Commit a3e77b89 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] page accounting atomicity fix

The global page accounting functions are currently using "+=" against a
ulong.  But this can happen at interrupt time as well, and "+=" is not
atomic against interrupt-time modification of the same word.

Change it to use local_irq_save()
parent c85e5289
...@@ -114,9 +114,10 @@ extern void get_full_page_state(struct page_state *ret); ...@@ -114,9 +114,10 @@ extern void get_full_page_state(struct page_state *ret);
#define mod_page_state(member, delta) \ #define mod_page_state(member, delta) \
do { \ do { \
int cpu = get_cpu(); \ unsigned long flags; \
per_cpu(page_states, cpu).member += (delta); \ local_irq_save(flags); \
put_cpu(); \ __get_cpu_var(page_states).member += (delta); \
local_irq_restore(flags); \
} while (0) } while (0)
#define inc_page_state(member) mod_page_state(member, 1UL) #define inc_page_state(member) mod_page_state(member, 1UL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment