diff options
author | Huang Shijie <shijie8@gmail.com> | 2009-09-21 20:03:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:17:41 -0400 |
commit | f8dbf0a7a4c5d98e8b70da9f7f4f6a89f3b7a7bb (patch) | |
tree | 1f40d51f39965017999c36e3a5ae78b67e43f5d5 /mm | |
parent | 252c5f94d944487e9f50ece7942b0fbf659c5c31 (diff) |
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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1191,21 +1191,21 @@ munmap_back: | |||
1191 | goto unmap_and_free_vma; | 1191 | goto unmap_and_free_vma; |
1192 | if (vm_flags & VM_EXECUTABLE) | 1192 | if (vm_flags & VM_EXECUTABLE) |
1193 | added_exe_file_vma(mm); | 1193 | added_exe_file_vma(mm); |
1194 | |||
1195 | /* Can addr have changed?? | ||
1196 | * | ||
1197 | * Answer: Yes, several device drivers can do it in their | ||
1198 | * f_op->mmap method. -DaveM | ||
1199 | */ | ||
1200 | addr = vma->vm_start; | ||
1201 | pgoff = vma->vm_pgoff; | ||
1202 | vm_flags = vma->vm_flags; | ||
1194 | } else if (vm_flags & VM_SHARED) { | 1203 | } else if (vm_flags & VM_SHARED) { |
1195 | error = shmem_zero_setup(vma); | 1204 | error = shmem_zero_setup(vma); |
1196 | if (error) | 1205 | if (error) |
1197 | goto free_vma; | 1206 | goto free_vma; |
1198 | } | 1207 | } |
1199 | 1208 | ||
1200 | /* Can addr have changed?? | ||
1201 | * | ||
1202 | * Answer: Yes, several device drivers can do it in their | ||
1203 | * f_op->mmap method. -DaveM | ||
1204 | */ | ||
1205 | addr = vma->vm_start; | ||
1206 | pgoff = vma->vm_pgoff; | ||
1207 | vm_flags = vma->vm_flags; | ||
1208 | |||
1209 | if (vma_wants_writenotify(vma)) | 1209 | if (vma_wants_writenotify(vma)) |
1210 | vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED); | 1210 | vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED); |
1211 | 1211 | ||