Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753972Ab2JOGAm (ORCPT ); Mon, 15 Oct 2012 02:00:42 -0400 Received: from mga03.intel.com ([143.182.124.21]:51834 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753803Ab2JOGAg (ORCPT ); Mon, 15 Oct 2012 02:00:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,587,1344236400"; d="scan'208";a="204457308" From: "Kirill A. Shutemov" To: Andrew Morton , Andrea Arcangeli , linux-mm@kvack.org Cc: Andi Kleen , "H. Peter Anvin" , linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , "Kirill A. Shutemov" Subject: [PATCH v4 05/10] thp: change_huge_pmd(): keep huge zero page write-protected Date: Mon, 15 Oct 2012 09:00:54 +0300 Message-Id: <1350280859-18801-6-git-send-email-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1350280859-18801-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1350280859-18801-1-git-send-email-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1037 Lines: 31 From: "Kirill A. Shutemov" We want to get page fault on write attempt to huge zero page, so let's keep it write-protected. Signed-off-by: Kirill A. Shutemov --- mm/huge_memory.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 76548b1..8dbb1e4 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1258,6 +1258,8 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, pmd_t entry; entry = pmdp_get_and_clear(mm, addr, pmd); entry = pmd_modify(entry, newprot); + if (is_huge_zero_pmd(entry)) + entry = pmd_wrprotect(entry); set_pmd_at(mm, addr, pmd, entry); spin_unlock(&vma->vm_mm->page_table_lock); ret = 1; -- 1.7.7.6 -- 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/