drm/amdgpu: add eviction counter
authorChristian König <christian.koenig@amd.com>
Tue, 21 Jun 2016 14:28:14 +0000 (16:28 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:54:49 +0000 (14:54 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index c1abe0900f4807a30ff8fc448edad8031e0e8480..f4d269931dbeee21d05bfd3a23c16755d72cb123 100644 (file)
@@ -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 */
index f85527fbbac5e716aa2c559192f2bccd185d7c45..b7742e62972a61aae553dca11477e89ab8be6e2e 100644 (file)
@@ -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;