aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/sys_sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/sys_sh.c')
-rw-r--r--arch/sh/kernel/sys_sh.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index df5ac294c379..917b2f32f260 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -79,6 +79,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
79 (!vma || addr + len <= vma->vm_start)) 79 (!vma || addr + len <= vma->vm_start))
80 return addr; 80 return addr;
81 } 81 }
82 if (len <= mm->cached_hole_size) {
83 mm->cached_hole_size = 0;
84 mm->free_area_cache = TASK_UNMAPPED_BASE;
85 }
82 if (flags & MAP_PRIVATE) 86 if (flags & MAP_PRIVATE)
83 addr = PAGE_ALIGN(mm->free_area_cache); 87 addr = PAGE_ALIGN(mm->free_area_cache);
84 else 88 else
@@ -95,6 +99,7 @@ full_search:
95 */ 99 */
96 if (start_addr != TASK_UNMAPPED_BASE) { 100 if (start_addr != TASK_UNMAPPED_BASE) {
97 start_addr = addr = TASK_UNMAPPED_BASE; 101 start_addr = addr = TASK_UNMAPPED_BASE;
102 mm->cached_hole_size = 0;
98 goto full_search; 103 goto full_search;
99 } 104 }
100 return -ENOMEM; 105 return -ENOMEM;
@@ -106,6 +111,9 @@ full_search:
106 mm->free_area_cache = addr + len; 111 mm->free_area_cache = addr + len;
107 return addr; 112 return addr;
108 } 113 }
114 if (addr + mm->cached_hole_size < vma->vm_start)
115 mm->cached_hole_size = vma->vm_start - addr;
116
109 addr = vma->vm_end; 117 addr = vma->vm_end;
110 if (!(flags & MAP_PRIVATE)) 118 if (!(flags & MAP_PRIVATE))
111 addr = COLOUR_ALIGN(addr); 119 addr = COLOUR_ALIGN(addr);