summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Shijie <shijie8@gmail.com>2009-09-21 17:03:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 07:17:41 -0700
commitf8dbf0a7a4c5d98e8b70da9f7f4f6a89f3b7a7bb (patch)
tree1f40d51f39965017999c36e3a5ae78b67e43f5d5
parent252c5f94d944487e9f50ece7942b0fbf659c5c31 (diff)
downloadop-kernel-dev-f8dbf0a7a4c5d98e8b70da9f7f4f6a89f3b7a7bb.zip
op-kernel-dev-f8dbf0a7a4c5d98e8b70da9f7f4f6a89f3b7a7bb.tar.gz
mmap: save some cycles for the shared anonymous mapping
shmem_zero_setup() does not change vm_start, pgoff or vm_flags, only some drivers change them (such as /driver/video/bfin-t350mcqb-fb.c). Move these codes to a more proper place to save cycles for shared anonymous mapping. Signed-off-by: Huang Shijie <shijie8@gmail.com> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/mmap.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index b6d74b3..1aeef66 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1191,21 +1191,21 @@ munmap_back:
goto unmap_and_free_vma;
if (vm_flags & VM_EXECUTABLE)
added_exe_file_vma(mm);
+
+ /* Can addr have changed??
+ *
+ * Answer: Yes, several device drivers can do it in their
+ * f_op->mmap method. -DaveM
+ */
+ addr = vma->vm_start;
+ pgoff = vma->vm_pgoff;
+ vm_flags = vma->vm_flags;
} else if (vm_flags & VM_SHARED) {
error = shmem_zero_setup(vma);
if (error)
goto free_vma;
}
- /* Can addr have changed??
- *
- * Answer: Yes, several device drivers can do it in their
- * f_op->mmap method. -DaveM
- */
- addr = vma->vm_start;
- pgoff = vma->vm_pgoff;
- vm_flags = vma->vm_flags;
-
if (vma_wants_writenotify(vma))
vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);
OpenPOWER on IntegriCloud