Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320765
b: refs/heads/master
c: 76dcee7
h: refs/heads/master
i:
  320763: abce05b
v: v3
  • Loading branch information
Aneesh Kumar K.V authored and Linus Torvalds committed Aug 1, 2012
1 parent 3e5e848 commit 63ba28f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 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: 47d38344abd0c7c6793b59ac741aa5b205fc197c
refs/heads/master: 76dcee75c1aff61259f5ed55e2bcfab60cc4bd5f
18 changes: 13 additions & 5 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,10 +1123,10 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma,
*/
chg = vma_needs_reservation(h, vma, addr);
if (chg < 0)
return ERR_PTR(-VM_FAULT_OOM);
return ERR_PTR(-ENOMEM);
if (chg)
if (hugepage_subpool_get_pages(spool, chg))
return ERR_PTR(-VM_FAULT_SIGBUS);
return ERR_PTR(-ENOSPC);

spin_lock(&hugetlb_lock);
page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve);
Expand All @@ -1136,7 +1136,7 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma,
page = alloc_buddy_huge_page(h, NUMA_NO_NODE);
if (!page) {
hugepage_subpool_put_pages(spool, chg);
return ERR_PTR(-VM_FAULT_SIGBUS);
return ERR_PTR(-ENOSPC);
}
}

Expand Down Expand Up @@ -2496,6 +2496,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
new_page = alloc_huge_page(vma, address, outside_reserve);

if (IS_ERR(new_page)) {
long err = PTR_ERR(new_page);
page_cache_release(old_page);

/*
Expand Down Expand Up @@ -2524,7 +2525,10 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,

/* Caller expects lock to be held */
spin_lock(&mm->page_table_lock);
return -PTR_ERR(new_page);
if (err == -ENOMEM)
return VM_FAULT_OOM;
else
return VM_FAULT_SIGBUS;
}

/*
Expand Down Expand Up @@ -2642,7 +2646,11 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
goto out;
page = alloc_huge_page(vma, address, 0);
if (IS_ERR(page)) {
ret = -PTR_ERR(page);
ret = PTR_ERR(page);
if (ret == -ENOMEM)
ret = VM_FAULT_OOM;
else
ret = VM_FAULT_SIGBUS;
goto out;
}
clear_huge_page(page, address, pages_per_huge_page(h));
Expand Down

0 comments on commit 63ba28f

Please sign in to comment.