Commit d005f51e authored by Marcin Slusarz's avatar Marcin Slusarz Committed by Ben Skeggs

drm/nouveau: use vmalloc for pgt allocation

Page tables on nv50 take 48kB, which can be hard to allocate in one piece.
Let's use vmalloc.
Signed-off-by: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@vger.kernel.org [3.7+]
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 5c5ae715
...@@ -365,7 +365,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, ...@@ -365,7 +365,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
vm->fpde = offset >> (vmm->pgt_bits + 12); vm->fpde = offset >> (vmm->pgt_bits + 12);
vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12);
vm->pgt = kcalloc(vm->lpde - vm->fpde + 1, sizeof(*vm->pgt), GFP_KERNEL); vm->pgt = vzalloc((vm->lpde - vm->fpde + 1) * sizeof(*vm->pgt));
if (!vm->pgt) { if (!vm->pgt) {
kfree(vm); kfree(vm);
return -ENOMEM; return -ENOMEM;
...@@ -374,7 +374,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, ...@@ -374,7 +374,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12, ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12,
block >> 12); block >> 12);
if (ret) { if (ret) {
kfree(vm->pgt); vfree(vm->pgt);
kfree(vm); kfree(vm);
return ret; return ret;
} }
...@@ -450,7 +450,7 @@ nouveau_vm_del(struct nouveau_vm *vm) ...@@ -450,7 +450,7 @@ nouveau_vm_del(struct nouveau_vm *vm)
} }
nouveau_mm_fini(&vm->mm); nouveau_mm_fini(&vm->mm);
kfree(vm->pgt); vfree(vm->pgt);
kfree(vm); kfree(vm);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment