Commit e709accc authored by Jason Gunthorpe's avatar Jason Gunthorpe

mm/hmm: comment on VM_FAULT_RETRY semantics in handle_mm_fault

The magic dropping of mmap_sem when handle_mm_fault returns VM_FAULT_RETRY
is rather subtile.  Add a comment explaining it.

Link: https://lore.kernel.org/r/20190724065258.16603-8-hch@lst.deTested-by: default avatarRalph Campbell <rcampbell@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
[hch: wrote a changelog]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent f32471e2
...@@ -301,8 +301,10 @@ static int hmm_vma_do_fault(struct mm_walk *walk, unsigned long addr, ...@@ -301,8 +301,10 @@ static int hmm_vma_do_fault(struct mm_walk *walk, unsigned long addr,
flags |= hmm_vma_walk->block ? 0 : FAULT_FLAG_ALLOW_RETRY; flags |= hmm_vma_walk->block ? 0 : FAULT_FLAG_ALLOW_RETRY;
flags |= write_fault ? FAULT_FLAG_WRITE : 0; flags |= write_fault ? FAULT_FLAG_WRITE : 0;
ret = handle_mm_fault(vma, addr, flags); ret = handle_mm_fault(vma, addr, flags);
if (ret & VM_FAULT_RETRY) if (ret & VM_FAULT_RETRY) {
/* Note, handle_mm_fault did up_read(&mm->mmap_sem)) */
return -EAGAIN; return -EAGAIN;
}
if (ret & VM_FAULT_ERROR) { if (ret & VM_FAULT_ERROR) {
*pfn = range->values[HMM_PFN_ERROR]; *pfn = range->values[HMM_PFN_ERROR];
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment