summaryrefslogtreecommitdiff
path: root/mm/swap.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-05-23 13:04:31 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-24 09:56:09 -0700
commit80119ef5c8153e0a6cc5edf00c083dc98a9bd348 (patch)
treea2af11a3991b1bebe9d764ab6d4d28891e86eda2 /mm/swap.c
parent6c7c6afbb8c0e60d32a563cae7c6889211e9d9d8 (diff)
downloadlinux-3.10-80119ef5c8153e0a6cc5edf00c083dc98a9bd348.tar.gz
linux-3.10-80119ef5c8153e0a6cc5edf00c083dc98a9bd348.tar.bz2
linux-3.10-80119ef5c8153e0a6cc5edf00c083dc98a9bd348.zip
mm: fix atomic_t overflow in vm
The atomic_t type is 32bit but a 64bit system can have more than 2^32 pages of virtual address space available. Without this we overflow on ludicrously large mappings Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swap.c')
-rw-r--r--mm/swap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/swap.c b/mm/swap.c
index 91e194445a5..45c9f25a8a3 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -503,7 +503,7 @@ void vm_acct_memory(long pages)
local = &__get_cpu_var(committed_space);
*local += pages;
if (*local > ACCT_THRESHOLD || *local < -ACCT_THRESHOLD) {
- atomic_add(*local, &vm_committed_space);
+ atomic_long_add(*local, &vm_committed_space);
*local = 0;
}
preempt_enable();
@@ -520,7 +520,7 @@ static int cpu_swap_callback(struct notifier_block *nfb,
committed = &per_cpu(committed_space, (long)hcpu);
if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
- atomic_add(*committed, &vm_committed_space);
+ atomic_long_add(*committed, &vm_committed_space);
*committed = 0;
drain_cpu_pagevecs((long)hcpu);
}