Skip to contentSkip to conversation

drm/nouveau/kms/nv04: use vzalloc for nv04_display

PATCH In review Ilia Mirkin 2 participants 2 messages Mar 7, 2021 – Mar 24, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/nouveau/kms/nv04: use vzalloc for nv04_display

The struct is giant, and triggers an order-7 allocation (512K). There is no reason for this to be kmalloc-type memory, so switch to vmalloc. This should help loading nouveau on low-memory and/or long-running systems.

---
 drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/disp.c +2 -2
index 7739f46470d3..99fee4d8cd31 100644
@@ -205,7 +205,7 @@ nv04_display_destroy(struct drm_device *dev)
 	nvif_notify_dtor(&disp->flip);
 
 	nouveau_display(dev)->priv = NULL;
-	kfree(disp);
+	vfree(disp);
 
 	nvif_object_unmap(&drm->client.device.object);
 }
@@ -223,7 +223,7 @@ nv04_display_create(struct drm_device *dev)
 	struct nv04_display *disp;
 	int i, ret;
 
-	disp = kzalloc(sizeof(*disp), GFP_KERNEL);
+	disp = vzalloc(sizeof(*disp));
 	if (!disp)
 		return -ENOMEM;
 
Signature · 6 lines
2.26.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#1 lore raw
Quoted 8 lines · Ilia Mirkin

The struct is giant, and triggers an order-7 allocation (512K). There is no reason for this to be kmalloc-type memory, so switch to vmalloc. This should help loading nouveau on low-memory and/or long-running systems.

Thanks!

Quoted 29 lines
---
 drivers/gpu/drm/nouveau/dispnv04/disp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/disp.c +2 -3
index 7739f46470d3..99fee4d8cd31 100644
@@ -205,7 +205,7 @@ nv04_display_destroy(struct drm_device *dev)
        nvif_notify_dtor(&disp->flip);
 
        nouveau_display(dev)->priv = NULL;
-       kfree(disp);
+       vfree(disp);
 
        nvif_object_unmap(&drm->client.device.object);
 }
@@ -223,7 +223,7 @@ nv04_display_create(struct drm_device *dev)
        struct nv04_display *disp;
        int i, ret;
 
-       disp = kzalloc(sizeof(*disp), GFP_KERNEL);
+       disp = vzalloc(sizeof(*disp));
        if (!disp)
                return -ENOMEM;
 
--

2.26.2

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau