aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2013-02-27 20:02:51 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:09 -0500
commite759a798c639c8bde15c1baa35fb8b451856314b (patch)
treed306e4062b51b91fe86835f979ea7ff1c611edbd /arch/frv
parent309a85b6861fedbb48a22d45e0e079d1be993b3a (diff)
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>
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/mm/elf-fdpic.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c
index 385fd30b142f..836f14707a62 100644
--- a/arch/frv/mm/elf-fdpic.c
+++ b/arch/frv/mm/elf-fdpic.c
@@ -60,7 +60,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
60 unsigned long pgoff, unsigned long flags) 60 unsigned long pgoff, unsigned long flags)
61{ 61{
62 struct vm_area_struct *vma; 62 struct vm_area_struct *vma;
63 unsigned long limit; 63 struct vm_unmapped_area_info info;
64 64
65 if (len > TASK_SIZE) 65 if (len > TASK_SIZE)
66 return -ENOMEM; 66 return -ENOMEM;
@@ -79,39 +79,24 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
79 } 79 }
80 80
81 /* search between the bottom of user VM and the stack grow area */ 81 /* search between the bottom of user VM and the stack grow area */
82 addr = PAGE_SIZE; 82 info.flags = 0;
83 limit = (current->mm->start_stack - 0x00200000); 83 info.length = len;
84 if (addr + len <= limit) { 84 info.low_limit = PAGE_SIZE;
85 limit -= len; 85 info.high_limit = (current->mm->start_stack - 0x00200000);
86 86 info.align_mask = 0;
87 if (addr <= limit) { 87 info.align_offset = 0;
88 vma = find_vma(current->mm, PAGE_SIZE); 88 addr = vm_unmapped_area(&info);
89 for (; vma; vma = vma->vm_next) { 89 if (!(addr & ~PAGE_MASK))
90 if (addr > limit) 90 goto success;
91 break; 91 VM_BUG_ON(addr != -ENOMEM);
92 if (addr + len <= vma->vm_start)
93 goto success;
94 addr = vma->vm_end;
95 }
96 }
97 }
98 92
99 /* search from just above the WorkRAM area to the top of memory */ 93 /* search from just above the WorkRAM area to the top of memory */
100 addr = PAGE_ALIGN(0x80000000); 94 info.low_limit = PAGE_ALIGN(0x80000000);
101 limit = TASK_SIZE - len; 95 info.high_limit = TASK_SIZE;
102 if (addr <= limit) { 96 addr = vm_unmapped_area(&info);
103 vma = find_vma(current->mm, addr); 97 if (!(addr & ~PAGE_MASK))
104 for (; vma; vma = vma->vm_next) { 98 goto success;
105 if (addr > limit) 99 VM_BUG_ON(addr != -ENOMEM);
106 break;
107 if (addr + len <= vma->vm_start)
108 goto success;
109 addr = vma->vm_end;
110 }
111
112 if (!vma && addr <= limit)
113 goto success;
114 }
115 100
116#if 0 101#if 0
117 printk("[area] l=%lx (ENOMEM) f='%s'\n", 102 printk("[area] l=%lx (ENOMEM) f='%s'\n",