Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754606AbYCLRfB (ORCPT ); Wed, 12 Mar 2008 13:35:01 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753832AbYCLRce (ORCPT ); Wed, 12 Mar 2008 13:32:34 -0400 Received: from mtagate4.de.ibm.com ([195.212.29.153]:55361 "EHLO mtagate4.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780AbYCLRcY (ORCPT ); Wed, 12 Mar 2008 13:32:24 -0400 Message-Id: <20080312173217.941471391@de.ibm.com> References: <20080312173155.703966894@de.ibm.com> User-Agent: quilt/0.46-1 Date: Wed, 12 Mar 2008 18:32:03 +0100 From: Martin Schwidefsky To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Andi Kleen , "David S. Miller" , "H. Peter Anvin" , Ingo Molnar , Paul Mackerras , Paul Mundt , Thomas Gleixner , Tony Luck , Gerald Schaefer , Martin Schwidefsky Subject: [patch 08/10] Add missing TLB flush to hugetlb_cow(). Content-Disposition: inline; filename=108-hugetlb-tlbflush.diff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2469 Lines: 66 From: Gerald Schaefer A cow break on a hugetlbfs page with page_count > 1 will set a new pte with set_huge_pte_at(), w/o any tlb flush operation. The old pte will remain in the tlb and subsequent write access to the page will result in a page fault loop, for as long as it may take until the tlb is flushed from somewhere else. This patch introduces an architecture-specific huge_ptep_clear_flush() function, which is called before the the set_huge_pte_at() in hugetlb_cow(). Cc: Andi Kleen Cc: David S. Miller Cc: H. Peter Anvin Cc: Ingo Molnar Cc: Paul Mackerras Cc: Paul Mundt Cc: Thomas Gleixner Cc: Tony Luck Signed-off-by: Gerald Schaefer Signed-off-by: Martin Schwidefsky --- include/linux/hugetlb.h | 4 ++++ mm/hugetlb.c | 1 + 2 files changed, 5 insertions(+) Index: quilt-2.6/include/linux/hugetlb.h =================================================================== --- quilt-2.6.orig/include/linux/hugetlb.h +++ quilt-2.6/include/linux/hugetlb.h @@ -80,6 +80,10 @@ static inline int prepare_hugepage_range int prepare_hugepage_range(unsigned long addr, unsigned long len); #endif +#ifndef ARCH_HAS_HUGEPAGE_CLEAR_FLUSH +#define huge_ptep_clear_flush(vma, addr, ptep) do { } while (0) +#endif + #ifndef ARCH_HAS_SETCLEAR_HUGE_PTE #define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte) #define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep) Index: quilt-2.6/mm/hugetlb.c =================================================================== --- quilt-2.6.orig/mm/hugetlb.c +++ quilt-2.6/mm/hugetlb.c @@ -864,6 +864,7 @@ static int hugetlb_cow(struct mm_struct ptep = huge_pte_offset(mm, address & HPAGE_MASK); if (likely(pte_same(*ptep, pte))) { /* Break COW */ + huge_ptep_clear_flush(vma, address, ptep); set_huge_pte_at(mm, address, ptep, make_huge_pte(vma, new_page, 1)); /* Make the old page be freed below */ -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/