All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Matthew Wilcox <willy@linux.intel.com>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	Linux MM <linux-mm@kvack.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dax: Split pmd map when fallback on COW
Date: Mon, 23 Nov 2015 13:45:59 -0700	[thread overview]
Message-ID: <1448311559.19320.2.camel@hpe.com> (raw)
In-Reply-To: <CAPcyv4ibgtMJdKG19vaS_s2_eFy8ufZm92G2DH6N7brDiE+LYA@mail.gmail.com>

On Mon, 2015-11-23 at 12:45 -0800, Dan Williams wrote:
> On Mon, Nov 23, 2015 at 12:05 PM, Toshi Kani <toshi.kani@hpe.com> 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 <toshi.kani@hpe.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Matthew Wilcox <willy@linux.intel.com>
> > Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> 
> 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Toshi Kani <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Matthew Wilcox <willy@linux.intel.com>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	Linux MM <linux-mm@kvack.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@ml01.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dax: Split pmd map when fallback on COW
Date: Mon, 23 Nov 2015 13:45:59 -0700	[thread overview]
Message-ID: <1448311559.19320.2.camel@hpe.com> (raw)
In-Reply-To: <CAPcyv4ibgtMJdKG19vaS_s2_eFy8ufZm92G2DH6N7brDiE+LYA@mail.gmail.com>

On Mon, 2015-11-23 at 12:45 -0800, Dan Williams wrote:
> On Mon, Nov 23, 2015 at 12:05 PM, Toshi Kani <toshi.kani@hpe.com> 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 <toshi.kani@hpe.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Matthew Wilcox <willy@linux.intel.com>
> > Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> 
> 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


  reply	other threads:[~2015-11-23 20:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 20:05 [PATCH] dax: Split pmd map when fallback on COW Toshi Kani
2015-11-23 20:05 ` Toshi Kani
2015-11-23 20:45 ` Dan Williams
2015-11-23 20:45   ` Dan Williams
2015-11-23 20:45   ` Toshi Kani [this message]
2015-11-23 20:45     ` Toshi Kani
2015-11-23 20:56     ` Dan Williams
2015-11-23 20:56       ` Dan Williams
2015-11-23 21:04       ` Toshi Kani
2015-11-23 21:04         ` Toshi Kani
2015-11-23 22:58 ` Toshi Kani
2015-11-23 22:58   ` Toshi Kani
2015-11-24 17:08 ` Dan Williams
2015-11-24 17:08   ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448311559.19320.2.camel@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=dan.j.williams@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=ross.zwisler@linux.intel.com \
    --cc=willy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.