Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292628
b: refs/heads/master
c: 4bfc130
h: refs/heads/master
v: v3
  • Loading branch information
Xiao Guangrong authored and Linus Torvalds committed Mar 22, 2012
1 parent d409b43 commit e5abd97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aad6ec3777bf4930d4f7293745cc4c17a2d87947
refs/heads/master: 4bfc130d5afa28395288d1b57092906349604b41
15 changes: 11 additions & 4 deletions trunk/fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
return addr;
}

start_addr = mm->free_area_cache;

if (len <= mm->cached_hole_size)
if (len > mm->cached_hole_size)
start_addr = mm->free_area_cache;
else {
start_addr = TASK_UNMAPPED_BASE;
mm->cached_hole_size = 0;
}

full_search:
addr = ALIGN(start_addr, huge_page_size(h));
Expand All @@ -171,13 +173,18 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
*/
if (start_addr != TASK_UNMAPPED_BASE) {
start_addr = TASK_UNMAPPED_BASE;
mm->cached_hole_size = 0;
goto full_search;
}
return -ENOMEM;
}

if (!vma || addr + len <= vma->vm_start)
if (!vma || addr + len <= vma->vm_start) {
mm->free_area_cache = addr + len;
return addr;
}
if (addr + mm->cached_hole_size < vma->vm_start)
mm->cached_hole_size = vma->vm_start - addr;
addr = ALIGN(vma->vm_end, huge_page_size(h));
}
}
Expand Down

0 comments on commit e5abd97

Please sign in to comment.