소스 검색

drm/amdgpu: add eviction counter

Keep track of the number of evictions since boot.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Christian König 9 년 전
부모
커밋
dbd5ed60ac
2개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      drivers/gpu/drm/amd/amdgpu/amdgpu.h
  2. 5 0
      drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

+ 1 - 0
drivers/gpu/drm/amd/amdgpu/amdgpu.h

@@ -2042,6 +2042,7 @@ struct amdgpu_device {
 	atomic64_t			vram_vis_usage;
 	atomic64_t			gtt_usage;
 	atomic64_t			num_bytes_moved;
+	atomic64_t			num_evictions;
 	atomic_t			gpu_reset_counter;
 
 	/* display */

+ 5 - 0
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

@@ -397,6 +397,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo,
 		return -EINVAL;
 
 	adev = amdgpu_get_adev(bo->bdev);
+
+	/* remember the eviction */
+	if (evict)
+		atomic64_inc(&adev->num_evictions);
+
 	if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
 		amdgpu_move_null(bo, new_mem);
 		return 0;