mm: use vm_unmapped_area() on frv architecture
Update the frv arch_get_unmapped_area function to make use of vm_unmapped_area() instead of implementing a brute force search. Signed-off-by: Michel Lespinasse <walken@google.com> Acked-by: Rik van Riel <riel@redhat.com> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
309a85b686
commit
e759a798c6
|
@ -60,7 +60,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
|
||||||
unsigned long pgoff, unsigned long flags)
|
unsigned long pgoff, unsigned long flags)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
unsigned long limit;
|
struct vm_unmapped_area_info info;
|
||||||
|
|
||||||
if (len > TASK_SIZE)
|
if (len > TASK_SIZE)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -79,39 +79,24 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search between the bottom of user VM and the stack grow area */
|
/* search between the bottom of user VM and the stack grow area */
|
||||||
addr = PAGE_SIZE;
|
info.flags = 0;
|
||||||
limit = (current->mm->start_stack - 0x00200000);
|
info.length = len;
|
||||||
if (addr + len <= limit) {
|
info.low_limit = PAGE_SIZE;
|
||||||
limit -= len;
|
info.high_limit = (current->mm->start_stack - 0x00200000);
|
||||||
|
info.align_mask = 0;
|
||||||
if (addr <= limit) {
|
info.align_offset = 0;
|
||||||
vma = find_vma(current->mm, PAGE_SIZE);
|
addr = vm_unmapped_area(&info);
|
||||||
for (; vma; vma = vma->vm_next) {
|
if (!(addr & ~PAGE_MASK))
|
||||||
if (addr > limit)
|
goto success;
|
||||||
break;
|
VM_BUG_ON(addr != -ENOMEM);
|
||||||
if (addr + len <= vma->vm_start)
|
|
||||||
goto success;
|
|
||||||
addr = vma->vm_end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* search from just above the WorkRAM area to the top of memory */
|
/* search from just above the WorkRAM area to the top of memory */
|
||||||
addr = PAGE_ALIGN(0x80000000);
|
info.low_limit = PAGE_ALIGN(0x80000000);
|
||||||
limit = TASK_SIZE - len;
|
info.high_limit = TASK_SIZE;
|
||||||
if (addr <= limit) {
|
addr = vm_unmapped_area(&info);
|
||||||
vma = find_vma(current->mm, addr);
|
if (!(addr & ~PAGE_MASK))
|
||||||
for (; vma; vma = vma->vm_next) {
|
goto success;
|
||||||
if (addr > limit)
|
VM_BUG_ON(addr != -ENOMEM);
|
||||||
break;
|
|
||||||
if (addr + len <= vma->vm_start)
|
|
||||||
goto success;
|
|
||||||
addr = vma->vm_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vma && addr <= limit)
|
|
||||||
goto success;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printk("[area] l=%lx (ENOMEM) f='%s'\n",
|
printk("[area] l=%lx (ENOMEM) f='%s'\n",
|
||||||
|
|
Loading…
Reference in New Issue