summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2009-04-27 18:20:59 -0700
committerArve Hjønnevåg <arve@android.com>2009-04-28 15:25:16 -0700
commit11fd1772d96736c065f722d6d8a5092f086be3f7 (patch)
treea60c5eaa14460f14a198a5ca9cce3d4e7eb84d31 /mm
parent0bdcd41c3693827df10ec24d04f37db3ec04c571 (diff)
ashmem: Don't install fault handler for private mmaps.
Ashmem is used to create named private heaps. If this heap is backed by a tmpfs file it will allocate two pages for every page touched. In 2.6.27, the extra page would later be freed, but 2.6.29 does not scan anonymous pages when running without swap so the memory is not freed while the file is referenced. This change changes the behavior of private ashmem mmaps to match /dev/zero instead tmpfs. Signed-off-by: Arve Hjønnevåg <arve@android.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/ashmem.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/ashmem.c b/mm/ashmem.c
index 96062cfa6faa..83ecd0017fa6 100644
--- a/mm/ashmem.c
+++ b/mm/ashmem.c
@@ -242,7 +242,13 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
}
get_file(asma->file);
- shmem_set_file(vma, asma->file);
+ if (vma->vm_flags & VM_SHARED)
+ shmem_set_file(vma, asma->file);
+ else {
+ if (vma->vm_file)
+ fput(vma->vm_file);
+ vma->vm_file = asma->file;
+ }
vma->vm_flags |= VM_CAN_NONLINEAR;
out: