Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114687
b: refs/heads/master
c: b4d1d99
h: refs/heads/master
i:
  114685: f260492
  114683: 1b8e6b5
  114679: 9991b6b
  114671: bb1f8ee
  114655: 34d2d6d
  114623: f572d57
  114559: f2bec94
  114431: 7ac63b8
  114175: d406eed
  113663: e6a0e50
  112639: 6447e5a
  110591: 6c83fc6
  106495: 875b556
  98303: 8d3fd52
v: v3
  • Loading branch information
David Gibson authored and Linus Torvalds committed Oct 16, 2008
1 parent 9c29035 commit b5e6a13
Show file tree
Hide file tree
Showing 2 changed files with 19 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: db99100d2ed40dd9736fcb1adb3657a98f9bcfd9
refs/heads/master: b4d1d99fdd8b98fb03dfd6ef9b0ece220de38640
23 changes: 18 additions & 5 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +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);
goto out_unlock;
goto out_mutex;
}

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

if (!(vma->vm_flags & VM_SHARED))
Expand All @@ -2034,18 +2034,31 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,

spin_lock(&mm->page_table_lock);
/* Check for a racing update before calling hugetlb_cow */
if (likely(pte_same(entry, huge_ptep_get(ptep))))
if (write_access && !pte_write(entry))
if (unlikely(!pte_same(entry, huge_ptep_get(ptep))))
goto out_page_table_lock;


if (write_access) {
if (!pte_write(entry)) {
ret = hugetlb_cow(mm, vma, address, ptep, entry,
pagecache_page);
goto out_page_table_lock;
}
entry = pte_mkdirty(entry);
}
entry = pte_mkyoung(entry);
if (huge_ptep_set_access_flags(vma, address, ptep, entry, write_access))
update_mmu_cache(vma, address, entry);

out_page_table_lock:
spin_unlock(&mm->page_table_lock);

if (pagecache_page) {
unlock_page(pagecache_page);
put_page(pagecache_page);
}

out_unlock:
out_mutex:
mutex_unlock(&hugetlb_instantiation_mutex);

return ret;
Expand Down

0 comments on commit b5e6a13

Please sign in to comment.