Right now every time the fdinfo is read, we go through the vm lists and lock all the BOs to calcuate the statistics. This causes a lot of lock contention when the VM is actively used. It gets worse if there is a lot of shared BOs or if there's a lot of submissions. We have seen submissions lock-up for seconds due to fdinfo for some workload. Therefore, rework the implementation to track the BOs as they get moved around. Also the visible memory stat is removed to simplify implementation, it's unclear how useful this stat is since kernel map/unmap BOs whenever it wants to and on a modern system all of VRAM can be mapped if needed. v5: rebase on top of the drm_print_memory_stats refactor Yunxiang Li (4): drm/amdgpu: remove unused function parameter drm/amdgpu: make drm-memory-* report resident memory drm/amdgpu: stop tracking visible memory stats drm/amdgpu: track bo memory stats at runtime drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 16 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 24 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 94 +-------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 14 -- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 208 +++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 27 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 1 + drivers/gpu/drm/drm_file.c | 8 + include/drm/drm_file.h | 1 + 11 files changed, 241 insertions(+), 159 deletions(-) -- 2.34.1