From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629Ab1JPUlA (ORCPT ); Sun, 16 Oct 2011 16:41:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59702 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856Ab1JPUk5 (ORCPT ); Sun, 16 Oct 2011 16:40:57 -0400 From: Andrea Arcangeli To: Peter Zijlstra Cc: Andrew Morton , Minchan Kim , Michel Lespinasse , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , Johannes Weiner , Rik van Riel , Mel Gorman , KOSAKI Motohiro , Shaohua Li , "Paul E. McKenney" , Benjamin Herrenschmidt Subject: [PATCH 3/4] powerpc: gup_hugepte() avoid to free the head page too many times Date: Sun, 16 Oct 2011 22:40:38 +0200 Message-Id: <1318797639-26962-4-git-send-email-aarcange@redhat.com> In-Reply-To: <1316793432.9084.47.camel@twins> References: <1316793432.9084.47.camel@twins> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We only taken "refs" pins on the head page not "*nr" pins. Signed-off-by: Andrea Arcangeli 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; -- 1.7.3.4