From 3966efc2e58f1802411f44fd00967dde448f278d Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 11 Jan 2017 16:58:14 -0800 Subject: gpu: nvgpu: Give nvgpu_kalloc a less generic name Change nvgpu_kalloc() to nvgpu_big_[mz]alloc(). This is necessary since the natural free function name for this is nvgpu_kfree() but that conflicts with nvgpu_k[mz]alloc() (implemented in a subsequent patch). This API exists becasue not all allocation sizes can be determined at compile time and in some cases sizes may vary across the system page size. Thus always using kmalloc() could lead to OOM errors due to fragmentation. But always using vmalloc() is wastful of memory for small allocations. This API tries to alleviate those problems. Bug 1799159 Bug 1823380 Change-Id: I49ec5292ce13bcdecf112afbb4a0cfffeeb5ecfc Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1283827 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 6eb1cb06..f228110e 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -30,6 +30,8 @@ #include #include +#include +#include #include "gk20a.h" #include "debug_gk20a.h" @@ -37,8 +39,6 @@ #include "dbg_gpu_gk20a.h" #include "fence_gk20a.h" -#include - #include #include #include @@ -986,7 +986,7 @@ static void gk20a_free_channel(struct channel_gk20a *ch, bool force) memset(&ch->ramfc, 0, sizeof(struct mem_desc_sub)); gk20a_gmmu_unmap_free(ch_vm, &ch->gpfifo.mem); - nvgpu_kfree(ch->gpfifo.pipe); + nvgpu_big_free(ch->gpfifo.pipe); memset(&ch->gpfifo, 0, sizeof(struct gpfifo_desc)); #if defined(CONFIG_GK20A_CYCLE_STATS) @@ -1856,9 +1856,8 @@ int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c, } if (c->gpfifo.mem.aperture == APERTURE_VIDMEM || g->mm.force_pramin) { - c->gpfifo.pipe = nvgpu_kalloc( - gpfifo_size * sizeof(struct nvgpu_gpfifo), - false); + c->gpfifo.pipe = nvgpu_big_malloc( + gpfifo_size * sizeof(struct nvgpu_gpfifo)); if (!c->gpfifo.pipe) { err = -ENOMEM; goto clean_up_unmap; @@ -1928,7 +1927,7 @@ clean_up_sync: c->sync = NULL; } clean_up_unmap: - nvgpu_kfree(c->gpfifo.pipe); + nvgpu_big_free(c->gpfifo.pipe); gk20a_gmmu_unmap_free(ch_vm, &c->gpfifo.mem); clean_up: memset(&c->gpfifo, 0, sizeof(struct gpfifo_desc)); @@ -2058,12 +2057,12 @@ static void trace_write_pushbuffer_range(struct channel_gk20a *c, if (!g) { size = count * sizeof(struct nvgpu_gpfifo); if (size) { - g = nvgpu_kalloc(size, false); + g = nvgpu_big_malloc(size); if (!g) return; if (copy_from_user(g, user_gpfifo, size)) { - nvgpu_kfree(g); + nvgpu_big_free(g); return; } } @@ -2075,7 +2074,7 @@ static void trace_write_pushbuffer_range(struct channel_gk20a *c, trace_write_pushbuffer(c, gp); if (gpfifo_allocated) - nvgpu_kfree(g); + nvgpu_big_free(g); } static void __gk20a_channel_timeout_start(struct channel_gk20a *ch) -- cgit v1.2.2