linux/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
/* Evict a userptr BO by stopping the queues if necessary
 *
 * Runs in MMU notifier, may be in RECLAIM_FS context. This means it
 * cannot do any memory allocations, and cannot take any locks that
 * are held elsewhere while allocating memory. Therefore this is as
 * simple as possible, using atomic counters.
 *
 * It doesn't do anything to the BO itself. The real work happens in
 * restore, where we get updated page addresses. This function only
 * ensures that GPU access to the BO is stopped.
 */
Evict a userptr BO by stopping the queues if necessary
Runs in MMU notifier, may be in RECLAIM_FS context. This means it
cannot do any memory allocations, and cannot take any locks that
are held elsewhere while allocating memory. Therefore this is as
simple as possible, using atomic counters.

It doesn't do anything to the BO itself. The real work happens in
restore, where we get updated page addresses. This function only
ensures that GPU access to the BO is stopped.
Evict a userptr BO by stopping the queues if necessary Runs in MMU notifier may be in RECLAIM_FS context . This means it cannot do any memory allocations and cannot take any locks that are held elsewhere while allocating memory . Therefore this is as simple as possible using atomic counters . It doesn ' t do anything to the BO itself . The real work happens in restore where we get updated page addresses . This function only ensures that GPU access to the BO is stopped .
int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem,
				struct mm_struct *mm)
{
	struct amdkfd_process_info *process_info = mem->process_info;
	int invalid, evicted_bos;
	int r = 0;
	invalid = atomic_inc_return(&mem->invalid);
	evicted_bos = atomic_inc_return(&process_info->evicted_bos);
	if (evicted_bos == 1) {
		r = kgd2kfd->quiesce_mm(mm);
		if (r)
			pr_err("Failed to quiesce KFD\n");
		schedule_delayed_work(&process_info->restore_userptr_work,
			msecs_to_jiffies(AMDGPU_USERPTR_RESTORE_DELAY_MS));
	}
	return r;
}
int amdgpu_amdkfd_evict_userptr ( struct kgd_mem * mem , struct mm_struct * mm ) { struct amdkfd_process_info * process_info = mem -> process_info ; int invalid , evicted_bos ; int r = 0 ; invalid = atomic_inc_return ( & mem -> invalid ) ; evicted_bos = atomic_inc_return ( & process_info -> evicted_bos ) ; if ( evicted_bos == 1 ) { r = kgd2kfd -> quiesce_mm ( mm ) ; if ( r ) pr_err ( " \n " ) ; schedule_delayed_work ( & process_info -> restore_userptr_work , msecs_to_jiffies ( AMDGPU_USERPTR_RESTORE_DELAY_MS ) ) ; } return r ; }
Evict a userptr BO by stopping the queues if necessary
 Runs in MMU notifier, may be in RECLAIM_FS context.
Evict a userptr BO by stopping the queues if necessary Runs in MMU notifier may be in RECLAIM_FS context .
/* First eviction, stop the queues */