@@ -125,6 +125,17 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
&bdev->man[bo->mem.mem_type];
struct vm_area_struct cvma;
+ /*
+ * FAULT_FLAG_ALLOW_RETRY indicates that the caller would like to avoid
+ * IO waits with the mmap_sem held. With FAULT_FLAG_RETRY_NOWAIT,
+ * the caller would like an early return with VM_FAULT_RETRY and the
+ * mmap_sem held.
+ * If FAULT_FLAG_RETRY_NOWAIT is not set, then we should drop the
+ * mmap_sem, perform the wait and return VM_FAULT_RETRY without
+ * holding it. We implement this for sleeping bo reservations
+ * where the reservation holder may be waiting for fences, and for
+ * fence waits.
+ */
if (unlikely(!dma_resv_trylock(bo->base.resv))) {
if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {