Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755402AbbHDT64 (ORCPT ); Tue, 4 Aug 2015 15:58:56 -0400 Received: from mga11.intel.com ([192.55.52.93]:13229 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752609AbbHDT6P (ORCPT ); Tue, 4 Aug 2015 15:58:15 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,611,1432623600"; d="scan'208";a="776785070" From: Matthew Wilcox To: Andrew Morton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Matthew Wilcox Subject: [PATCH 10/11] dax: Ensure that zero pages are removed from other processes Date: Tue, 4 Aug 2015 15:58:04 -0400 Message-Id: <1438718285-21168-11-git-send-email-matthew.r.wilcox@intel.com> X-Mailer: git-send-email 2.4.6 In-Reply-To: <1438718285-21168-1-git-send-email-matthew.r.wilcox@intel.com> References: <1438718285-21168-1-git-send-email-matthew.r.wilcox@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1416 Lines: 40 From: Matthew Wilcox If the first access to a huge page was a store, there would be no existing zero pmd in this process's page tables. There could be a zero pmd in another process's page tables, if it had done a load. We can detect this case by noticing that the buffer_head returned from the filesystem is New, and ensure that other processes mapping this huge page have their page tables flushed. Reported-by: Kirill A. Shutemov Signed-off-by: Matthew Wilcox --- fs/dax.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index bf9a22b..233e61e 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -568,7 +568,11 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, if ((pgoff | PG_PMD_COLOUR) >= size) goto fallback; - if (is_huge_zero_pmd(*pmd)) + /* + * If we allocated new storage, make sure no process has any + * zero pages covering this hole + */ + if (buffer_new(&bh)) unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0); if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) { -- 2.1.4 -- 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/