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 <dbhosale@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1685312
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Bhosale
2018-03-30 11:35:27 -07:00
committed by mobile promotions
parent 9ed117dd01
commit 43bbd777c5

View File

@@ -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");