aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-03-21 19:34:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 20:54:59 -0400
commitb69add218d32450d6604bc9080f6e33e19b06f5e (patch)
tree67c91d3534c2f7bf01b03a49be7543abe77d16a6 /arch/x86/mm
parent40716e29243de46720e5773797791466c28904ec (diff)
hugetlb: remove prev_vma from hugetlb_get_unmapped_area_topdown()
After looking up the vma which covers or follows the cached search address, the following condition is always true: !prev_vma || (addr >= prev_vma->vm_end) so we can stop checking the previous VMA altogether. Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/hugetlbpage.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index c20e81c3425d..f6679a7fb8ca 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -308,7 +308,7 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
308{ 308{
309 struct hstate *h = hstate_file(file); 309 struct hstate *h = hstate_file(file);
310 struct mm_struct *mm = current->mm; 310 struct mm_struct *mm = current->mm;
311 struct vm_area_struct *vma, *prev_vma; 311 struct vm_area_struct *vma;
312 unsigned long base = mm->mmap_base; 312 unsigned long base = mm->mmap_base;
313 unsigned long addr = addr0; 313 unsigned long addr = addr0;
314 unsigned long largest_hole = mm->cached_hole_size; 314 unsigned long largest_hole = mm->cached_hole_size;
@@ -340,22 +340,14 @@ try_again:
340 if (!vma) 340 if (!vma)
341 return addr; 341 return addr;
342 342
343 /* 343 if (addr + len <= vma->vm_start) {
344 * new region fits between prev_vma->vm_end and
345 * vma->vm_start, use it:
346 */
347 prev_vma = vma->vm_prev;
348 if (addr + len <= vma->vm_start &&
349 (!prev_vma || (addr >= prev_vma->vm_end))) {
350 /* remember the address as a hint for next time */ 344 /* remember the address as a hint for next time */
351 mm->cached_hole_size = largest_hole; 345 mm->cached_hole_size = largest_hole;
352 return (mm->free_area_cache = addr); 346 return (mm->free_area_cache = addr);
353 } else { 347 } else if (mm->free_area_cache == vma->vm_end) {
354 /* pull free_area_cache down to the first hole */ 348 /* pull free_area_cache down to the first hole */
355 if (mm->free_area_cache == vma->vm_end) { 349 mm->free_area_cache = vma->vm_start;
356 mm->free_area_cache = vma->vm_start; 350 mm->cached_hole_size = largest_hole;
357 mm->cached_hole_size = largest_hole;
358 }
359 } 351 }
360 352
361 /* remember the largest hole we saw so far */ 353 /* remember the largest hole we saw so far */