From 43ae97000be786e4118d431637f05b1462e296c4 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 26 Jul 2017 14:35:48 -0700 Subject: gpu: nvgpu: Use non-contig mem in pd_cache In the PD caching code use a non-contiguous DMA alloc for PAGE_SIZE and below allocations. There's no need for using the special contig pool of mem for these page sized allocs so wasting said mem can lead us to OOM problems pretty quickly (think large sparse textures, for example). Also turn several pd_dbg() statements for printing OOM errors into nvgpu_err()s since knowing exactly where an alloc fails is very convenient. Bug 200326705 Change-Id: Ib7c45020894d4bdd73cc92179ef707e472714d61 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1527294 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/mm/pd_cache.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/pd_cache.c') diff --git a/drivers/gpu/nvgpu/common/mm/pd_cache.c b/drivers/gpu/nvgpu/common/mm/pd_cache.c index 4f312eff..2b6ca7e7 100644 --- a/drivers/gpu/nvgpu/common/mm/pd_cache.c +++ b/drivers/gpu/nvgpu/common/mm/pd_cache.c @@ -142,14 +142,13 @@ int __nvgpu_pd_cache_alloc_direct(struct gk20a *g, pd->mem = nvgpu_kzalloc(g, sizeof(*pd->mem)); if (!pd->mem) { - pd_dbg(g, "OOM allocating nvgpu_mem struct!"); + nvgpu_err(g, "OOM allocating nvgpu_mem struct!"); return -ENOMEM; } - err = nvgpu_dma_alloc_flags(g, NVGPU_DMA_FORCE_CONTIGUOUS, - bytes, pd->mem); + err = nvgpu_dma_alloc(g, bytes, pd->mem); if (err) { - pd_dbg(g, "OOM allocating page directory!"); + nvgpu_err(g, "OOM allocating page directory!"); nvgpu_kfree(g, pd->mem); return -ENOMEM; } @@ -175,14 +174,13 @@ static int nvgpu_pd_cache_alloc_new(struct gk20a *g, pentry = nvgpu_kzalloc(g, sizeof(*pentry)); if (!pentry) { - pd_dbg(g, "OOM allocating pentry!"); + nvgpu_err(g, "OOM allocating pentry!"); return -ENOMEM; } - if (nvgpu_dma_alloc_flags(g, NVGPU_DMA_FORCE_CONTIGUOUS, - PAGE_SIZE, &pentry->mem)) { + if (nvgpu_dma_alloc(g, PAGE_SIZE, &pentry->mem)) { nvgpu_kfree(g, pentry); - pd_dbg(g, "Unable to DMA alloc!"); + nvgpu_err(g, "Unable to DMA alloc!"); return -ENOMEM; } @@ -295,7 +293,7 @@ static int nvgpu_pd_cache_alloc(struct gk20a *g, struct nvgpu_pd_cache *cache, err = nvgpu_pd_cache_alloc_from_partial(g, cache, pentry, pd); if (err) - pd_dbg(g, "PD-Alloc [C] Failed!"); + nvgpu_err(g, "PD-Alloc [C] Failed!"); return err; } -- cgit v1.2.2