Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1556246

Re: [PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp

From Hugh Dickins <hughd@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp
Date 2017-01-11 08:10 +0100
Message-ID <sYlcJ-3Oz-13@gated-at.bofh.it> (permalink)
References <sW8Wl-6Vv-1@gated-at.bofh.it> <sWhPX-4HN-9@gated-at.bofh.it> <sYjXj-2Oy-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 10 Jan 2017, Hugh Dickins wrote:
> On Thu, 5 Jan 2017, Kirill A. Shutemov wrote:
> > On Thu, Jan 05, 2017 at 12:36:58AM -0500, Keno Fischer wrote:
> > >  struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
> > >  		pmd_t *pmd, int flags)
> > >  {
> > > @@ -783,7 +793,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
> > >  
> > >  	assert_spin_locked(pmd_lockptr(mm, pmd));
> > >  
> > > -	if (flags & FOLL_WRITE && !pmd_write(*pmd))
> > > +	if (flags & FOLL_WRITE && !can_follow_write_pmd(*pmd, flags))
> > >  		return NULL;
> > 
> > I don't think this part is needed: once we COW devmap PMD entry, we split
> > it into PTE table, so IIUC we never get here with PMD.
> 
> Hi Kirill,
> 
> Would you mind double-checking that?  You certainly know devmap
> better than me, but I feel safer with Keno's original as above.
> 
> I can see that fs/dax.c dax_iomap_pmd_fault() does
> 
> 	/* Fall back to PTEs if we're going to COW */
> 	if (write && !(vma->vm_flags & VM_SHARED))
> 		goto fallback;
> 
> But isn't there a case of O_RDWR fd, VM_SHARED PROT_READ mmap, and
> FOLL_FORCE write to it, which does not COW (but relies on FOLL_COW)?

And now I think I'm wrong, but please double-check even so: I think that
case gets ruled out by the !is_cow_mapping(vm_flags) check in mm/gup.c,
where we used to have a WARN_ON_ONCE() for a while.

Hugh

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp Keno Fischer <keno@juliacomputing.com> - 2017-01-05 06:40 +0100
  Re: [PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-01-05 16:10 +0100
    Re: [PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp Keno Fischer <keno@juliacomputing.com> - 2017-01-05 22:10 +0100
    Re: [PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp Hugh Dickins <hughd@google.com> - 2017-01-11 06:50 +0100
      Re: [PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp Hugh Dickins <hughd@google.com> - 2017-01-11 08:10 +0100
        Re: [PATCH] mm: Respect FOLL_FORCE/FOLL_COW for thp "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-01-11 12:40 +0100

csiph-web