Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1681711
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC v5 09/11] mm: Try spin lock in speculative path |
| Date | 2017-07-05 21:00 +0200 |
| Message-ID | <tZXGN-1Dt-9@gated-at.bofh.it> (permalink) |
| References | <tT3Hj-3lN-3@gated-at.bofh.it> <tT3Hk-3lN-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jun 16, 2017 at 07:52:33PM +0200, Laurent Dufour wrote:
> @@ -2294,8 +2295,19 @@ static bool pte_map_lock(struct vm_fault *vmf)
> if (vma_has_changed(vmf->vma, vmf->sequence))
> goto out;
>
> - pte = pte_offset_map_lock(vmf->vma->vm_mm, vmf->pmd,
> - vmf->address, &ptl);
> + /* Same as pte_offset_map_lock() except that we call
comment style..
> + * spin_trylock() in place of spin_lock() to avoid race with
> + * unmap path which may have the lock and wait for this CPU
> + * to invalidate TLB but this CPU has irq disabled.
> + * Since we are in a speculative patch, accept it could fail
> + */
> + ptl = pte_lockptr(vmf->vma->vm_mm, vmf->pmd);
> + pte = pte_offset_map(vmf->pmd, vmf->address);
> + if (unlikely(!spin_trylock(ptl))) {
> + pte_unmap(pte);
> + goto out;
> + }
> +
> if (vma_has_changed(vmf->vma, vmf->sequence)) {
> pte_unmap_unlock(pte, ptl);
> goto out;
Right, so if you look at my earlier patches you'll see I did something
quite disgusting here.
Not sure that wants repeating, but I cannot remember why I thought this
deadlock didn't exist anymore.
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [RFC v5 09/11] mm: Try spin lock in speculative path Peter Zijlstra <peterz@infradead.org> - 2017-07-05 21:00 +0200
Re: [RFC v5 09/11] mm: Try spin lock in speculative path Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-07-06 15:50 +0200
Re: [RFC v5 09/11] mm: Try spin lock in speculative path Peter Zijlstra <peterz@infradead.org> - 2017-07-06 16:50 +0200
Re: [RFC v5 09/11] mm: Try spin lock in speculative path Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-07-06 17:30 +0200
Re: [RFC v5 09/11] mm: Try spin lock in speculative path Peter Zijlstra <peterz@infradead.org> - 2017-07-06 18:20 +0200
csiph-web