drm/vc4: Use kvmalloc_objs() for the BO cache size list

The BO cache size list has one entry per BO page count, so its size
scales with the largest BO ever freed. A 64 MiB BO already needs at
least an order-6 allocation, which fails under fragmentation and
triggers a warn_alloc() splat on BO close:

  page allocation failure: order:7, mode:0x40cc0(GFP_KERNEL|__GFP_COMP)
  Call trace:
   ...
   warn_alloc+0x118/0x190
   __alloc_pages_slowpath+0x4a8/0x520
   ...
   __kmalloc_noprof+0x3ac/0x5d8
   vc4_free_object+0x128/0x370 [vc4]
   drm_gem_object_handle_put_unlocked+0xb8/0x158 [drm]
   drm_gem_object_release_handle+0x74/0xe8 [drm]
   drm_gem_handle_delete+0x6c/0xa8 [drm]
   drm_gem_close_ioctl+0x34/0x50 [drm]

The list doesn't need physically contiguous memory. Use kvmalloc_objs()
so large lists can fall back to vmalloc(), avoiding the allocation
failure.

Fixes: c826a6e106 ("drm/vc4: Add a BO cache.")
Reviewed-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Link: https://patch.msgid.link/20260930190721.1897264-2-mcanal@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
This commit is contained in:
Maíra Canal 2026-09-30 16:06:51 -03:00
commit bca45af599
No known key found for this signature in database
GPG key ID: 3FF30E8A7688FAAA