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/mm_gk20a.h | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index d7f6cb9a..5b96726f 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -791,33 +791,6 @@ int gk20a_big_pages_possible(struct vm_gk20a *vm, u64 base, u64 size); extern const struct gk20a_mmu_level gk20a_mm_levels_64k[]; extern const struct gk20a_mmu_level gk20a_mm_levels_128k[]; -static inline void *nvgpu_kalloc(size_t size, bool clear) -{ - void *p; - - if (size > PAGE_SIZE) { - if (clear) - p = vzalloc(size); - else - p = vmalloc(size); - } else { - if (clear) - p = kzalloc(size, GFP_KERNEL); - else - p = kmalloc(size, GFP_KERNEL); - } - - return p; -} - -static inline void nvgpu_kfree(void *p) -{ - if (virt_addr_valid(p)) - kfree(p); - else - vfree(p); -} - int gk20a_mm_get_buffer_info(struct device *dev, int dmabuf_fd, u64 *buffer_id, u64 *buffer_len); -- cgit v1.2.2