Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1706324
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC v5 02/11] mm: Prepare for FAULT_FLAG_SPECULATIVE |
| Date | 2017-08-08 12:50 +0200 |
| Message-ID | <ucafh-767-23@gated-at.bofh.it> (permalink) |
| References | <tT3Hj-3lN-3@gated-at.bofh.it> <tT3Hk-3lN-31@gated-at.bofh.it> <uc9VT-6Xw-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Aug 08, 2017 at 03:54:01PM +0530, Anshuman Khandual wrote:
> On 06/16/2017 11:22 PM, Laurent Dufour wrote:
> > From: Peter Zijlstra <peterz@infradead.org>
> >
> > When speculating faults (without holding mmap_sem) we need to validate
> > that the vma against which we loaded pages is still valid when we're
> > ready to install the new PTE.
> >
> > Therefore, replace the pte_offset_map_lock() calls that (re)take the
> > PTL with pte_map_lock() which can fail in case we find the VMA changed
> > since we started the fault.
>
> Where we are checking if VMA has changed or not since the fault ?
Not there yet, this is what you call a preparatory patch. They help
review in that you can consider smaller steps.
> > diff --git a/mm/memory.c b/mm/memory.c
> > index fd952f05e016..40834444ea0d 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -2240,6 +2240,12 @@ static inline void wp_page_reuse(struct vm_fault *vmf)
> > pte_unmap_unlock(vmf->pte, vmf->ptl);
> > }
> >
> > +static bool pte_map_lock(struct vm_fault *vmf)
> > +{
> > + vmf->pte = pte_offset_map_lock(vmf->vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl);
> > + return true;
> > +}
>
> This is always true ? Then we should not have all these if (!pte_map_lock(vmf))
> check blocks down below.
Later patches will make it possible to return false. This patch is about
the placing this call. Having this in a separate patch makes it easier
to review all those new error conditions.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [RFC v5 02/11] mm: Prepare for FAULT_FLAG_SPECULATIVE Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-08-08 12:30 +0200 Re: [RFC v5 02/11] mm: Prepare for FAULT_FLAG_SPECULATIVE Peter Zijlstra <peterz@infradead.org> - 2017-08-08 12:50 +0200
csiph-web