diff options
| author | Andrew Morton <akpm@digeo.com> | 2002-10-31 20:01:38 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-10-31 20:01:38 -0800 |
| commit | a3e77b8983416407b5aa9ebc2849714e84b978f5 (patch) | |
| tree | 7249fa9c8cd0c763985192f61e19b37fafa41327 /include/linux | |
| parent | c85e5289f4cd42f7fcbab858ba733164e8589114 (diff) | |
[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()
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/page-flags.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 282902bb9816..9b3496e2aac5 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -114,9 +114,10 @@ extern void get_full_page_state(struct page_state *ret); #define mod_page_state(member, delta) \ do { \ - int cpu = get_cpu(); \ - per_cpu(page_states, cpu).member += (delta); \ - put_cpu(); \ + unsigned long flags; \ + local_irq_save(flags); \ + __get_cpu_var(page_states).member += (delta); \ + local_irq_restore(flags); \ } while (0) #define inc_page_state(member) mod_page_state(member, 1UL) |
