aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-06 21:23:36 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-06 21:23:36 -0500
commit097d59106a8e4b42d07c9892fdd7790f1659c6ff (patch)
treebabf61a0287b0f09f80580847274877831ed6869 /arch/x86/mm
parent71fece9511717750d86691e0f517ad04f3c8a801 (diff)
vm: avoid using find_vma_prev() unnecessarily
Several users of "find_vma_prev()" were not in fact interested in the previous vma if there was no primary vma to be found either. And in those cases, we're much better off just using the regular "find_vma()", and then "prev" can be looked up by just checking vma->vm_prev. The find_vma_prev() semantics are fairly subtle (see Mikulas' recent commit 83cd904d271b: "mm: fix find_vma_prev"), and the whole "return prev by reference" means that it generates worse code too. Thus this "let's avoid using this inconvenient and clearly too subtle interface when we don't really have to" patch. Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/hugetlbpage.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index f581a18c0d4d..83e7141c3982 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -333,13 +333,15 @@ try_again:
333 * Lookup failure means no vma is above this address, 333 * Lookup failure means no vma is above this address,
334 * i.e. return with success: 334 * i.e. return with success:
335 */ 335 */
336 if (!(vma = find_vma_prev(mm, addr, &prev_vma))) 336 vma = find_vma(mm, add);
337 if (!vma)
337 return addr; 338 return addr;
338 339
339 /* 340 /*
340 * new region fits between prev_vma->vm_end and 341 * new region fits between prev_vma->vm_end and
341 * vma->vm_start, use it: 342 * vma->vm_start, use it:
342 */ 343 */
344 prev_vma = vma->vm_prev;
343 if (addr + len <= vma->vm_start && 345 if (addr + len <= vma->vm_start &&
344 (!prev_vma || (addr >= prev_vma->vm_end))) { 346 (!prev_vma || (addr >= prev_vma->vm_end))) {
345 /* remember the address as a hint for next time */ 347 /* remember the address as a hint for next time */