drm/virtio: use kvmalloc for large allocations
Subsystems (4)
PATCH 1/1 drm/virtio: use kvmalloc for large allocations
From: Sergey Senozhatsky <[email protected]>
commit ea86f3defd55f141a44146e66cbf8ffb683d60da upstream.
We observed that some of virtio_gpu_object_shmem_init() allocations can be rather costly - order 6 - which can be difficult to fulfill under memory pressure conditions. Switch to kvmalloc_array() in virtio_gpu_object_shmem_init() and let the kernel vmalloc the entries array.
Signed-off-by Sergey Senozhatsky <[email protected]>
Cc [email protected] [5.10+]
Signed-off-by Gerd Hoffmann <[email protected]>
Signed-off-by Doug Horn <[email protected]>
--- drivers/gpu/drm/virtio/virtgpu_object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_object.c +3 -2
@@ -172,8 +172,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, *nents = shmem->pages->orig_nents; } - *ents =kmalloc_array (*nents,sizeof (struct virtio_gpu_mem_entry ), -GFP_KERNEL ); + *ents =kvmalloc_array (*nents, +sizeof (struct virtio_gpu_mem_entry ), +GFP_KERNEL );if (!(*ents)) {DRM_ERROR ("failed to allocate ent list\n" );return -ENOMEM ;
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog