diff options
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/mmap.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index 32c4b0e35b37..3de7f84b53c2 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c | |||
@@ -73,7 +73,12 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
73 | (!vma || addr + len <= vma->vm_start)) | 73 | (!vma || addr + len <= vma->vm_start)) |
74 | return addr; | 74 | return addr; |
75 | } | 75 | } |
76 | start_addr = addr = mm->free_area_cache; | 76 | if (len > mm->cached_hole_size) { |
77 | start_addr = addr = mm->free_area_cache; | ||
78 | } else { | ||
79 | start_addr = addr = TASK_UNMAPPED_BASE; | ||
80 | mm->cached_hole_size = 0; | ||
81 | } | ||
77 | 82 | ||
78 | full_search: | 83 | full_search: |
79 | if (do_align) | 84 | if (do_align) |
@@ -90,6 +95,7 @@ full_search: | |||
90 | */ | 95 | */ |
91 | if (start_addr != TASK_UNMAPPED_BASE) { | 96 | if (start_addr != TASK_UNMAPPED_BASE) { |
92 | start_addr = addr = TASK_UNMAPPED_BASE; | 97 | start_addr = addr = TASK_UNMAPPED_BASE; |
98 | mm->cached_hole_size = 0; | ||
93 | goto full_search; | 99 | goto full_search; |
94 | } | 100 | } |
95 | return -ENOMEM; | 101 | return -ENOMEM; |
@@ -101,6 +107,8 @@ full_search: | |||
101 | mm->free_area_cache = addr + len; | 107 | mm->free_area_cache = addr + len; |
102 | return addr; | 108 | return addr; |
103 | } | 109 | } |
110 | if (addr + mm->cached_hole_size < vma->vm_start) | ||
111 | mm->cached_hole_size = vma->vm_start - addr; | ||
104 | addr = vma->vm_end; | 112 | addr = vma->vm_end; |
105 | if (do_align) | 113 | if (do_align) |
106 | addr = COLOUR_ALIGN(addr, pgoff); | 114 | addr = COLOUR_ALIGN(addr, pgoff); |