summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-01-11 19:58:14 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-03 13:34:43 -0500
commit3966efc2e58f1802411f44fd00967dde448f278d (patch)
treeb6cf822abc638b79acbd12b749a97ab5507a6fe9 /drivers/gpu/nvgpu/gk20a/mm_gk20a.h
parent76b78b6fdcb0bbed72645aaa85de6013e2b135c3 (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/mm_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.h27
1 files changed, 0 insertions, 27 deletions
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);
791extern const struct gk20a_mmu_level gk20a_mm_levels_64k[]; 791extern const struct gk20a_mmu_level gk20a_mm_levels_64k[];
792extern const struct gk20a_mmu_level gk20a_mm_levels_128k[]; 792extern const struct gk20a_mmu_level gk20a_mm_levels_128k[];
793 793
794static inline void *nvgpu_kalloc(size_t size, bool clear)
795{
796 void *p;
797
798 if (size > PAGE_SIZE) {
799 if (clear)
800 p = vzalloc(size);
801 else
802 p = vmalloc(size);
803 } else {
804 if (clear)
805 p = kzalloc(size, GFP_KERNEL);
806 else
807 p = kmalloc(size, GFP_KERNEL);
808 }
809
810 return p;
811}
812
813static inline void nvgpu_kfree(void *p)
814{
815 if (virt_addr_valid(p))
816 kfree(p);
817 else
818 vfree(p);
819}
820
821int gk20a_mm_get_buffer_info(struct device *dev, int dmabuf_fd, 794int gk20a_mm_get_buffer_info(struct device *dev, int dmabuf_fd,
822 u64 *buffer_id, u64 *buffer_len); 795 u64 *buffer_id, u64 *buffer_len);
823 796