From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754801AbbKWUuY (ORCPT ); Mon, 23 Nov 2015 15:50:24 -0500 Received: from g4t3425.houston.hp.com ([15.201.208.53]:42458 "EHLO g4t3425.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbbKWUuU (ORCPT ); Mon, 23 Nov 2015 15:50:20 -0500 Message-ID: <1448311559.19320.2.camel@hpe.com> Subject: Re: [PATCH] dax: Split pmd map when fallback on COW From: Toshi Kani To: Dan Williams Cc: "Kirill A. Shutemov" , Matthew Wilcox , Ross Zwisler , Linux MM , linux-fsdevel , "linux-nvdimm@lists.01.org" , "linux-kernel@vger.kernel.org" Date: Mon, 23 Nov 2015 13:45:59 -0700 In-Reply-To: References: <1448309120-20911-1-git-send-email-toshi.kani@hpe.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 (3.16.5-3.fc22) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2015-11-23 at 12:45 -0800, Dan Williams wrote: > On Mon, Nov 23, 2015 at 12:05 PM, Toshi Kani wrote: > > An infinite loop of PMD faults was observed when attempted to > > mlock() a private read-only PMD mmap'd range of a DAX file. > > > > __dax_pmd_fault() simply returns with VM_FAULT_FALLBACK when > > falling back to PTE on COW. However, __handle_mm_fault() > > returns without falling back to handle_pte_fault() because > > a PMD map is present in this case. > > > > Change __dax_pmd_fault() to split the PMD map, if present, > > before returning with VM_FAULT_FALLBACK. > > > > Signed-off-by: Toshi Kani > > Cc: Dan Williams > > Cc: Kirill A. Shutemov > > Cc: Matthew Wilcox > > Cc: Ross Zwisler > > I thought the patch from Ross already addressed the infinite loop: > > https://patchwork.kernel.org/patch/7653731/ This fixes a different issue. I hit this one while testing my other patch along with the Ross's patch. > > --- > > fs/dax.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/fs/dax.c b/fs/dax.c > > index 43671b6..3405583 100644 > > --- a/fs/dax.c > > +++ b/fs/dax.c > > @@ -546,8 +546,10 @@ int __dax_pmd_fault(struct vm_area_struct *vma, > > unsigned long address, > > return VM_FAULT_FALLBACK; > > > > /* Fall back to PTEs if we're going to COW */ > > - if (write && !(vma->vm_flags & VM_SHARED)) > > + if (write && !(vma->vm_flags & VM_SHARED)) { > > + split_huge_page_pmd(vma, address, pmd); > > return VM_FAULT_FALLBACK; > > + } > > /* If the PMD would extend outside the VMA */ > > if (pmd_addr < vma->vm_start) > > return VM_FAULT_FALLBACK; > > This is a nop if CONFIG_TRANSPARENT_HUGEPAGE=n, so I don't think it's > a complete fix. Well, __dax_pmd_fault() itself depends on CONFIG_TRANSPARENT_HUGEPAGE. Thanks, -Toshi