Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108249
b: refs/heads/master
c: 2b26736
h: refs/heads/master
i:
  108247: 002f2d6
v: v3
  • Loading branch information
Andy Whitcroft authored and Linus Torvalds committed Aug 12, 2008
1 parent dcaea87 commit e28dfd9
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: 57303d80175e10056bf51206f9961d586f02f967
refs/heads/master: 2b26736c88db85c038e04c2306d0745553e69602
15 changes: 11 additions & 4 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1949,7 +1949,10 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
* the spinlock.
*/
if (write_access && !(vma->vm_flags & VM_SHARED))
vma_needs_reservation(h, vma, address);
if (vma_needs_reservation(h, vma, address) < 0) {
ret = VM_FAULT_OOM;
goto backout_unlocked;
}

spin_lock(&mm->page_table_lock);
size = i_size_read(mapping->host) >> huge_page_shift(h);
Expand All @@ -1976,6 +1979,7 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,

backout:
spin_unlock(&mm->page_table_lock);
backout_unlocked:
unlock_page(page);
put_page(page);
goto out;
Expand Down Expand Up @@ -2004,8 +2008,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
entry = huge_ptep_get(ptep);
if (huge_pte_none(entry)) {
ret = hugetlb_no_page(mm, vma, address, ptep, write_access);
mutex_unlock(&hugetlb_instantiation_mutex);
return ret;
goto out_unlock;
}

ret = 0;
Expand All @@ -2019,7 +2022,10 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
* consumed.
*/
if (write_access && !pte_write(entry)) {
vma_needs_reservation(h, vma, address);
if (vma_needs_reservation(h, vma, address) < 0) {
ret = VM_FAULT_OOM;
goto out_unlock;
}

if (!(vma->vm_flags & VM_SHARED))
pagecache_page = hugetlbfs_pagecache_page(h,
Expand All @@ -2039,6 +2045,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
put_page(pagecache_page);
}

out_unlock:
mutex_unlock(&hugetlb_instantiation_mutex);

return ret;
Expand Down

0 comments on commit e28dfd9

Please sign in to comment.