From: Chris Metcalf Date: Thu, 10 May 2012 20:01:44 +0000 (-0700) Subject: hugetlb: prevent BUG_ON in hugetlb_fault() -> hugetlb_cow() X-Git-Tag: v3.3.7~27 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=332c1d641e68608638dcd11588b348c37173be09;p=karo-tx-linux.git hugetlb: prevent BUG_ON in hugetlb_fault() -> hugetlb_cow() commit 4998a6c0edce7fae9c0a5463f6ec3fa585258ee7 upstream. Commit 66aebce747eaf ("hugetlb: fix race condition in hugetlb_fault()") added code to avoid a race condition by elevating the page refcount in hugetlb_fault() while calling hugetlb_cow(). However, one code path in hugetlb_cow() includes an assertion that the page count is 1, whereas it may now also have the value 2 in this path. The consensus is that this BUG_ON has served its purpose, so rather than extending it to cover both cases, we just remove it. Signed-off-by: Chris Metcalf Acked-by: Mel Gorman Acked-by: Hillf Danton Acked-by: Hugh Dickins Cc: Michal Hocko Cc: KAMEZAWA Hiroyuki Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 24b1787b525a..fece52019c53 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2486,7 +2486,6 @@ retry_avoidcopy: if (outside_reserve) { BUG_ON(huge_pte_none(pte)); 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); ptep = huge_pte_offset(mm, address & huge_page_mask(h));