This avoids unnecessary evictions and failed restores due to the
munmap of userptr BOs that are just about to be freed.

Change-Id: Icf2f0b73991455556a201c54c05ea7e20af80f47
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Этот коммит содержится в:
Felix Kuehling
2017-02-06 15:49:12 -05:00
родитель cb0f851560
Коммит 74ebfca9f0
+7 -3
Просмотреть файл
@@ -1277,6 +1277,13 @@ static void __fmm_release(void *address, manageble_aperture_t *aperture)
return;
}
/* If memory is user memory and it's still GPU mapped, munmap
* would cause an eviction. If the restore happens quickly
* enough, restore would also fail with an error message. So
* free the BO before unmapping the pages. */
args.handle = object->handle;
kmtIoctl(kfd_fd, AMDKFD_IOC_FREE_MEMORY_OF_GPU, &args);
if (address >= dgpu_shared_aperture_base &&
address <= dgpu_shared_aperture_limit) {
/* Remove any CPU mapping, but keep the address range reserved */
@@ -1284,9 +1291,6 @@ static void __fmm_release(void *address, manageble_aperture_t *aperture)
MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE | MAP_FIXED, -1, 0);
}
args.handle = object->handle;
kmtIoctl(kfd_fd, AMDKFD_IOC_FREE_MEMORY_OF_GPU, &args);
aperture_release_area(aperture, address, object->size);
vm_remove_object(aperture, object);