From: Andrea Arcangeli Date: Wed, 2 Nov 2011 20:37:11 +0000 (-0700) Subject: powerpc: gup_hugepte() avoid freeing the head page too many times X-Git-Tag: upstream/snapshot3+hdmi~8842^2~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8596468487e2062cae2aad56e973784e03959245;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git powerpc: gup_hugepte() avoid freeing the head page too many times We only taken "refs" pins on the head page not "*nr" pins. Signed-off-by: Andrea Arcangeli Cc: Peter Zijlstra Cc: Hugh Dickins Cc: Johannes Weiner Cc: Rik van Riel Cc: Mel Gorman Cc: KOSAKI Motohiro Cc: Benjamin Herrenschmidt Acked-by: David Gibson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index b649c28..78b14ab 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -428,10 +428,9 @@ static noinline int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long add if (unlikely(pte_val(pte) != pte_val(*ptep))) { /* Could be optimized better */ - while (*nr) { + *nr -= refs; + while (refs--) put_page(head); - (*nr)--; - } } return 1;