]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
powerpc: gup_hugepte() avoid to free the head page too many times
authorAndrea Arcangeli <aarcange@redhat.com>
Mon, 24 Oct 2011 14:54:22 +0000 (01:54 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 25 Oct 2011 09:07:47 +0000 (20:07 +1100)
We only taken "refs" pins on the head page not "*nr" pins.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <jweiner@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/powerpc/mm/hugetlbpage.c

index 201aa6dc66c69eb656a12ef3bcdd7d2b6ce459c1..fea5748b412f0af1b91c1c0bb5f3c692c92fbdd9 100644 (file)
@@ -652,10 +652,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;