Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176302
b: refs/heads/master
c: b76c8cf
h: refs/heads/master
v: v3
  • Loading branch information
Larry Woodman authored and Linus Torvalds committed Dec 15, 2009
1 parent a0f3845 commit b347a6a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 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: b4e655a4aaa327810110457cef92681447dd13e4
refs/heads/master: b76c8cfbff94263fdf2f408e94b78b049c24a9dc
13 changes: 11 additions & 2 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,9 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
outside_reserve = 1;

page_cache_get(old_page);

/* Drop page_table_lock as buddy allocator may be called */
spin_unlock(&mm->page_table_lock);
new_page = alloc_huge_page(vma, address, outside_reserve);

if (IS_ERR(new_page)) {
Expand All @@ -2310,19 +2313,25 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
if (unmap_ref_private(mm, vma, old_page, address)) {
BUG_ON(page_count(old_page) != 1);
BUG_ON(huge_pte_none(pte));
spin_lock(&mm->page_table_lock);
goto retry_avoidcopy;
}
WARN_ON_ONCE(1);
}

/* Caller expects lock to be held */
spin_lock(&mm->page_table_lock);
return -PTR_ERR(new_page);
}

spin_unlock(&mm->page_table_lock);
copy_huge_page(new_page, old_page, address, vma);
__SetPageUptodate(new_page);
spin_lock(&mm->page_table_lock);

/*
* Retake the page_table_lock to check for racing updates
* before the page tables are altered
*/
spin_lock(&mm->page_table_lock);
ptep = huge_pte_offset(mm, address & huge_page_mask(h));
if (likely(pte_same(huge_ptep_get(ptep), pte))) {
/* Break COW */
Expand Down

0 comments on commit b347a6a

Please sign in to comment.