Commit ea86f3de authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Gerd Hoffmann

drm/virtio: use kvmalloc for large allocations

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: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20201105014744.1662226-1-senozhatsky@chromium.orgSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent f3f0e410
...@@ -184,7 +184,8 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, ...@@ -184,7 +184,8 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,
*nents = shmem->pages->orig_nents; *nents = shmem->pages->orig_nents;
} }
*ents = kmalloc_array(*nents, sizeof(struct virtio_gpu_mem_entry), *ents = kvmalloc_array(*nents,
sizeof(struct virtio_gpu_mem_entry),
GFP_KERNEL); GFP_KERNEL);
if (!(*ents)) { if (!(*ents)) {
DRM_ERROR("failed to allocate ent list\n"); DRM_ERROR("failed to allocate ent list\n");
......
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