drm/amdgpu: increase hmm range get pages timeout
authorJames Zhu <James.Zhu@amd.com>
Fri, 8 Dec 2023 22:41:25 +0000 (17:41 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Dec 2023 17:16:34 +0000 (12:16 -0500)
When application tries to allocate all system memory and cause memory
to swap out. Needs more time for hmm_range_fault to validate the
remaining page for allocation. To be safe, increase timeout value to
1 second for 64MB range.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c

index 081267161d40185d10d6292a2ad4f474ab554b95..b24eb5821fd1960d4006d1a7b89c053729df0434 100644 (file)
@@ -190,8 +190,8 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
                pr_debug("hmm range: start = 0x%lx, end = 0x%lx",
                        hmm_range->start, hmm_range->end);
 
-               /* Assuming 128MB takes maximum 1 second to fault page address */
-               timeout = max((hmm_range->end - hmm_range->start) >> 27, 1UL);
+               /* Assuming 64MB takes maximum 1 second to fault page address */
+               timeout = max((hmm_range->end - hmm_range->start) >> 26, 1UL);
                timeout *= HMM_RANGE_DEFAULT_TIMEOUT;
                timeout = jiffies + msecs_to_jiffies(timeout);