diff options
author | Kerwin Wan <kerwinw@nvidia.com> | 2015-04-16 06:08:49 -0400 |
---|---|---|
committer | Ishan Mittal <imittal@nvidia.com> | 2015-05-18 02:03:31 -0400 |
commit | 8d177e7b744acfbe9740af1082397a0f6baa88ae (patch) | |
tree | 3a227eca1f4b10ed612b7096699bb32d3a7e71ff /drivers | |
parent | 16fc6e3931733c9d5ff87e0b889aa2b897c540c3 (diff) |
gpu: nvgpu: use vzalloc for mm entries
When system is in low memory, kzalloc will fail if
kernel requests more than PAGE_SIZE continous memory block.
Bug 200096099
Change-Id: I44e217ffa6aa6c453a4d4afba45a8ee3b5756cc1
Signed-off-by: Kerwin Wan <kerwinw@nvidia.com>
Reviewed-on: http://git-master/r/732197
(cherry picked from commit 62861976421415f93e98a0a9f977ac1f66046714)
Reviewed-on: http://git-master/r/737057
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Tested-by: Krishna Reddy <vdumpa@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index d896d783..5e1505c4 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -2288,8 +2288,8 @@ static int update_gmmu_level_locked(struct vm_gk20a *vm, | |||
2288 | (l->hi_bit[pgsz_idx] | 2288 | (l->hi_bit[pgsz_idx] |
2289 | - l->lo_bit[pgsz_idx] + 1); | 2289 | - l->lo_bit[pgsz_idx] + 1); |
2290 | pte->entries = | 2290 | pte->entries = |
2291 | kzalloc(sizeof(struct gk20a_mm_entry) * | 2291 | vzalloc(sizeof(struct gk20a_mm_entry) * |
2292 | num_entries, GFP_KERNEL); | 2292 | num_entries); |
2293 | if (!pte->entries) | 2293 | if (!pte->entries) |
2294 | return -ENOMEM; | 2294 | return -ENOMEM; |
2295 | pte->pgsz = pgsz_idx; | 2295 | pte->pgsz = pgsz_idx; |
@@ -2504,7 +2504,7 @@ static void gk20a_vm_free_entries(struct vm_gk20a *vm, | |||
2504 | 2504 | ||
2505 | if (parent->size) | 2505 | if (parent->size) |
2506 | free_gmmu_pages(vm, parent); | 2506 | free_gmmu_pages(vm, parent); |
2507 | kfree(parent->entries); | 2507 | vfree(parent->entries); |
2508 | parent->entries = NULL; | 2508 | parent->entries = NULL; |
2509 | } | 2509 | } |
2510 | 2510 | ||
@@ -2635,8 +2635,8 @@ int gk20a_init_vm(struct mm_gk20a *mm, | |||
2635 | pde_range_from_vaddr_range(vm, | 2635 | pde_range_from_vaddr_range(vm, |
2636 | 0, vm->va_limit-1, | 2636 | 0, vm->va_limit-1, |
2637 | &pde_lo, &pde_hi); | 2637 | &pde_lo, &pde_hi); |
2638 | vm->pdb.entries = kzalloc(sizeof(struct gk20a_mm_entry) * | 2638 | vm->pdb.entries = vzalloc(sizeof(struct gk20a_mm_entry) * |
2639 | (pde_hi + 1), GFP_KERNEL); | 2639 | (pde_hi + 1)); |
2640 | vm->pdb.num_entries = pde_hi + 1; | 2640 | vm->pdb.num_entries = pde_hi + 1; |
2641 | 2641 | ||
2642 | if (!vm->pdb.entries) | 2642 | if (!vm->pdb.entries) |
@@ -2703,7 +2703,7 @@ clean_up_small_allocator: | |||
2703 | clean_up_ptes: | 2703 | clean_up_ptes: |
2704 | free_gmmu_pages(vm, &vm->pdb); | 2704 | free_gmmu_pages(vm, &vm->pdb); |
2705 | clean_up_pdes: | 2705 | clean_up_pdes: |
2706 | kfree(vm->pdb.entries); | 2706 | vfree(vm->pdb.entries); |
2707 | return err; | 2707 | return err; |
2708 | } | 2708 | } |
2709 | 2709 | ||