diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-01-11 19:58:14 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-03 13:34:43 -0500 |
commit | 3966efc2e58f1802411f44fd00967dde448f278d (patch) | |
tree | b6cf822abc638b79acbd12b749a97ab5507a6fe9 /drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |
parent | 76b78b6fdcb0bbed72645aaa85de6013e2b135c3 (diff) |
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 <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1283827
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index cb4f8007..36b85f3b 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/bsearch.h> | 31 | #include <linux/bsearch.h> |
32 | #include <trace/events/gk20a.h> | 32 | #include <trace/events/gk20a.h> |
33 | 33 | ||
34 | #include <nvgpu/kmem.h> | ||
34 | #include <nvgpu/timers.h> | 35 | #include <nvgpu/timers.h> |
35 | #include <nvgpu/nvgpu_common.h> | 36 | #include <nvgpu/nvgpu_common.h> |
36 | 37 | ||
@@ -3423,7 +3424,7 @@ static void gk20a_remove_gr_support(struct gr_gk20a *gr) | |||
3423 | gr->ctx_vars.local_golden_image = NULL; | 3424 | gr->ctx_vars.local_golden_image = NULL; |
3424 | 3425 | ||
3425 | if (gr->ctx_vars.hwpm_ctxsw_buffer_offset_map) | 3426 | if (gr->ctx_vars.hwpm_ctxsw_buffer_offset_map) |
3426 | nvgpu_kfree(gr->ctx_vars.hwpm_ctxsw_buffer_offset_map); | 3427 | nvgpu_big_free(gr->ctx_vars.hwpm_ctxsw_buffer_offset_map); |
3427 | gr->ctx_vars.hwpm_ctxsw_buffer_offset_map = NULL; | 3428 | gr->ctx_vars.hwpm_ctxsw_buffer_offset_map = NULL; |
3428 | 3429 | ||
3429 | gk20a_comptag_allocator_destroy(&gr->comp_tags); | 3430 | gk20a_comptag_allocator_destroy(&gr->comp_tags); |
@@ -8054,7 +8055,7 @@ static int gr_gk20a_create_hwpm_ctxsw_buffer_offset_map(struct gk20a *g) | |||
8054 | hwpm_ctxsw_reg_count_max = hwpm_ctxsw_buffer_size >> 2; | 8055 | hwpm_ctxsw_reg_count_max = hwpm_ctxsw_buffer_size >> 2; |
8055 | map_size = hwpm_ctxsw_reg_count_max * sizeof(*map); | 8056 | map_size = hwpm_ctxsw_reg_count_max * sizeof(*map); |
8056 | 8057 | ||
8057 | map = nvgpu_kalloc(map_size, true); | 8058 | map = nvgpu_big_zalloc(map_size); |
8058 | if (!map) | 8059 | if (!map) |
8059 | return -ENOMEM; | 8060 | return -ENOMEM; |
8060 | 8061 | ||
@@ -8144,7 +8145,7 @@ static int gr_gk20a_create_hwpm_ctxsw_buffer_offset_map(struct gk20a *g) | |||
8144 | return 0; | 8145 | return 0; |
8145 | cleanup: | 8146 | cleanup: |
8146 | gk20a_err(dev_from_gk20a(g), "Failed to create HWPM buffer offset map"); | 8147 | gk20a_err(dev_from_gk20a(g), "Failed to create HWPM buffer offset map"); |
8147 | nvgpu_kfree(map); | 8148 | nvgpu_big_free(map); |
8148 | return -EINVAL; | 8149 | return -EINVAL; |
8149 | } | 8150 | } |
8150 | 8151 | ||