All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -resend] drm/nouveau: use vmalloc for pgt allocation
@ 2013-06-21 18:57 Jiri Slaby
  2013-06-21 18:59 ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2013-06-21 18:57 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Marcin Slusarz, stable, Frederic Crozat, Jiri Slaby

From: Marcin Slusarz <marcin.slusarz@gmail.com>

Page tables on nv50 take 48kB, which can be hard to allocate in one piece.
Let's use vmalloc.

[js] It is a pain for opensuse users as they see it on a daily basis.
Let's fix it for good. One example of a trace is as follows:

firefox: page allocation failure. order:3, mode:0x2000d0
Pid: 5068, comm: firefox Not tainted 3.7.9-3-desktop #1
Call Trace:
...
 [<ffffffff81114a52>] warn_alloc_failed+0x102/0x1b0
 [<ffffffff811189f3>] __alloc_pages_nodemask+0x793/0x9f0
 [<ffffffff811597f7>] kmem_getpages+0x57/0x1b0
 [<ffffffff8115a3e4>] fallback_alloc+0x174/0x270
 [<ffffffff8115abd9>] __kmalloc+0x1d9/0x240
 [<ffffffffa00ffb2b>] nouveau_vm_create+0xbb/0x160 [nouveau]
 [<ffffffffa0149110>] nouveau_drm_open+0xb0/0x140 [nouveau]
 [<ffffffffa0066a32>] drm_open+0x222/0x640 [drm]
...
SLAB: Unable to allocate memory on node 0 (gfp=0xd0)
  cache: size-65536, object size: 65536, order: 4
  node -1: slabs: 9/9, objs: 9/9, free: 0

References: https://bugzilla.novell.com/show_bug.cgi?id=802347
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@vger.kernel.org
Cc: Frederic Crozat <fcrozat@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
index 77c67fc..e66fb77 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
@@ -362,7 +362,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
 	vm->fpde = offset >> (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) {
 		kfree(vm);
 		return -ENOMEM;
@@ -371,7 +371,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
 	ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12,
 			      block >> 12);
 	if (ret) {
-		kfree(vm->pgt);
+		vfree(vm->pgt);
 		kfree(vm);
 		return ret;
 	}
@@ -446,7 +446,7 @@ nouveau_vm_del(struct nouveau_vm *vm)
 	}
 
 	nouveau_mm_fini(&vm->mm);
-	kfree(vm->pgt);
+	vfree(vm->pgt);
 	kfree(vm);
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -resend] drm/nouveau: use vmalloc for pgt allocation
  2013-06-21 18:57 [PATCH -resend] drm/nouveau: use vmalloc for pgt allocation Jiri Slaby
@ 2013-06-21 18:59 ` Jiri Slaby
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2013-06-21 18:59 UTC (permalink / raw)
  To: Jiri Slaby, akpm; +Cc: linux-kernel, Marcin Slusarz, stable, Frederic Crozat

Scratch this one. It's missing CCs.

On 06/21/2013 08:57 PM, Jiri Slaby wrote:
> From: Marcin Slusarz <marcin.slusarz@gmail.com>
> 
> Page tables on nv50 take 48kB, which can be hard to allocate in one piece.
> Let's use vmalloc.


-- 
js
suse labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH -resend] drm/nouveau: use vmalloc for pgt allocation
@ 2013-06-21 19:00 Jiri Slaby
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2013-06-21 19:00 UTC (permalink / raw)
  To: airlied
  Cc: akpm, linux-kernel, Marcin Slusarz, stable, Frederic Crozat,
	Ben Skeggs, dri-devel, Jiri Slaby

From: Marcin Slusarz <marcin.slusarz@gmail.com>

Page tables on nv50 take 48kB, which can be hard to allocate in one piece.
Let's use vmalloc.

[js] It is a pain for opensuse users as they see it on a daily basis.
Let's fix it for good. One example of a trace is as follows:

firefox: page allocation failure. order:3, mode:0x2000d0
Pid: 5068, comm: firefox Not tainted 3.7.9-3-desktop #1
Call Trace:
...
 [<ffffffff81114a52>] warn_alloc_failed+0x102/0x1b0
 [<ffffffff811189f3>] __alloc_pages_nodemask+0x793/0x9f0
 [<ffffffff811597f7>] kmem_getpages+0x57/0x1b0
 [<ffffffff8115a3e4>] fallback_alloc+0x174/0x270
 [<ffffffff8115abd9>] __kmalloc+0x1d9/0x240
 [<ffffffffa00ffb2b>] nouveau_vm_create+0xbb/0x160 [nouveau]
 [<ffffffffa0149110>] nouveau_drm_open+0xb0/0x140 [nouveau]
 [<ffffffffa0066a32>] drm_open+0x222/0x640 [drm]
...
SLAB: Unable to allocate memory on node 0 (gfp=0xd0)
  cache: size-65536, object size: 65536, order: 4
  node -1: slabs: 9/9, objs: 9/9, free: 0

References: https://bugzilla.novell.com/show_bug.cgi?id=802347
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@vger.kernel.org
Cc: Frederic Crozat <fcrozat@suse.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
index 77c67fc..e66fb77 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
@@ -362,7 +362,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
 	vm->fpde = offset >> (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) {
 		kfree(vm);
 		return -ENOMEM;
@@ -371,7 +371,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
 	ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12,
 			      block >> 12);
 	if (ret) {
-		kfree(vm->pgt);
+		vfree(vm->pgt);
 		kfree(vm);
 		return ret;
 	}
@@ -446,7 +446,7 @@ nouveau_vm_del(struct nouveau_vm *vm)
 	}
 
 	nouveau_mm_fini(&vm->mm);
-	kfree(vm->pgt);
+	vfree(vm->pgt);
 	kfree(vm);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-21 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21 18:57 [PATCH -resend] drm/nouveau: use vmalloc for pgt allocation Jiri Slaby
2013-06-21 18:59 ` Jiri Slaby
  -- strict thread matches above, loose matches on Subject: below --
2013-06-21 19:00 Jiri Slaby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.