From 43bbd777c5b259ad8df43dbe4c9e95277ec149b1 Mon Sep 17 00:00:00 2001 From: Deepak Bhosale Date: Fri, 30 Mar 2018 11:35:27 -0700 Subject: gpu: nvgpu: fix per-GPU DMA allocation tracking - total DMA memory allocation is currently tracked by adding page aligned size of nvgpu_mem - The sequence is roughly as follows: - total dma memory used += mem->aligned_size - mem->aligned_size = PAGE_ALIGN(size) - In above sequence, nvgpu_mem structure is initially zero when it is added to total dma memory used after which it is assigned page aligned value - This patch fixes total dma memory usage tracking. Change-Id: Ibb879c8d38ae9077c3d198d9bb008a72e9208b4d Signed-off-by: Deepak Bhosale Reviewed-on: https://git-master.nvidia.com/r/1685312 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Alex Waterman Reviewed-by: svc-mobile-coverity Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index 53e54bc6..f513dcd6 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c @@ -240,7 +240,7 @@ int nvgpu_dma_alloc_flags_sys(struct gk20a *g, unsigned long flags, * Before the debug print so we see this in the total. But during * cleanup in the fail path this has to be subtracted. */ - g->dma_memory_used += mem->aligned_size; + g->dma_memory_used += PAGE_ALIGN(size); dma_dbg_alloc(g, size, flags, "sysmem"); -- cgit v1.2.2