]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/sa: Split drm_suballoc_new() into SA alloc and init helpers
authorSatyanarayana K V P <satyanarayana.k.v.p@intel.com>
Fri, 20 Feb 2026 05:55:21 +0000 (05:55 +0000)
committerMatthew Brost <matthew.brost@intel.com>
Fri, 20 Feb 2026 18:54:02 +0000 (10:54 -0800)
commit16843e6638b743dd0376a1fc0845f2fd34daff98
tree309f769d868398532378b12c4929e9ed1256d5be
parenta5d5634cde48a9fcd68c8504aa07f89f175074a0
drm/sa: Split drm_suballoc_new() into SA alloc and init helpers

drm_suballoc_new() currently both allocates the SA object using kmalloc()
and searches for a suitable hole in the sub-allocator for the requested
size. If SA allocation is done by holding sub-allocator mutex, this design
can lead to reclaim safety issues.

By splitting the kmalloc() step outside of the critical section, we allow
the memory allocation to use GFP_KERNEL (reclaim-safe) while ensuring that
the initialization step that holds reclaim-tainted locks (sub-allocator
mutex) operates in a reclaim-unsafe context with pre-allocated memory.

This separation prevents potential deadlocks where memory reclaim could
attempt to acquire locks that are already held during the sub-allocator
operations.

Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Suggested-by: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Acked-by: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260220055519.2485681-6-satyanarayana.k.v.p@intel.com
drivers/gpu/drm/drm_suballoc.c
include/drm/drm_suballoc.h