Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36fd7c5c authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/amdgpu: prefer VMIDs idle on the current ring



Prefer to use a VMIDs which are idle on the ring we want to submit to. This
also removes bubbling idle VMIDs up on the LRU, which is actually not
beneficial.

Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarChunming Zhou <david1.zhou@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 35420238
Loading
Loading
Loading
Loading
+9 −15
Original line number Diff line number Diff line
@@ -236,21 +236,15 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,

	} while (i != ring->idx);

	id = list_first_entry(&adev->vm_manager.ids_lru,
			      struct amdgpu_vm_id,
			      list);

	if (!amdgpu_sync_is_idle(&id->active, NULL)) {
		struct list_head *head = &adev->vm_manager.ids_lru;
		struct amdgpu_vm_id *tmp;
	/* Check if we have an idle VMID */
	list_for_each_entry(id, &adev->vm_manager.ids_lru, list) {
		if (amdgpu_sync_is_idle(&id->active, ring))
			break;

		list_for_each_entry_safe(id, tmp, &adev->vm_manager.ids_lru,
					 list) {
			if (amdgpu_sync_is_idle(&id->active, NULL)) {
				list_move(&id->list, head);
				head = &id->list;
			}
	}

	/* If we can't find a idle VMID to use, just wait for the oldest */
	if (&id->list == &adev->vm_manager.ids_lru) {
		id = list_first_entry(&adev->vm_manager.ids_lru,
				      struct amdgpu_vm_id,
				      list);