Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/sched: De-clutter drm_sched_init

Move work queue allocation into a helper for a more streamlined function
body.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
Link: https://lore.kernel.org/r/20250704130754.89935-1-tvrtko.ursulin@igalia.com

authored by

Tvrtko Ursulin and committed by
Philipp Stanner
9cbc4052 86c947b3

+20 -13
+20 -13
drivers/gpu/drm/scheduler/sched_main.c
··· 84 84 #define CREATE_TRACE_POINTS 85 85 #include "gpu_scheduler_trace.h" 86 86 87 - #ifdef CONFIG_LOCKDEP 88 - static struct lockdep_map drm_sched_lockdep_map = { 89 - .name = "drm_sched_lockdep_map" 90 - }; 91 - #endif 92 - 93 87 int drm_sched_policy = DRM_SCHED_POLICY_FIFO; 94 88 95 89 /** ··· 1255 1261 drm_sched_run_job_queue(sched); 1256 1262 } 1257 1263 1264 + static struct workqueue_struct *drm_sched_alloc_wq(const char *name) 1265 + { 1266 + #if (IS_ENABLED(CONFIG_LOCKDEP)) 1267 + static struct lockdep_map map = { 1268 + .name = "drm_sched_lockdep_map" 1269 + }; 1270 + 1271 + /* 1272 + * Avoid leaking a lockdep map on each drm sched creation and 1273 + * destruction by using a single lockdep map for all drm sched 1274 + * allocated submit_wq. 1275 + */ 1276 + 1277 + return alloc_ordered_workqueue_lockdep_map(name, WQ_MEM_RECLAIM, &map); 1278 + #else 1279 + return alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); 1280 + #endif 1281 + } 1282 + 1258 1283 /** 1259 1284 * drm_sched_init - Init a gpu scheduler instance 1260 1285 * ··· 1314 1301 sched->submit_wq = args->submit_wq; 1315 1302 sched->own_submit_wq = false; 1316 1303 } else { 1317 - #ifdef CONFIG_LOCKDEP 1318 - sched->submit_wq = alloc_ordered_workqueue_lockdep_map(args->name, 1319 - WQ_MEM_RECLAIM, 1320 - &drm_sched_lockdep_map); 1321 - #else 1322 - sched->submit_wq = alloc_ordered_workqueue(args->name, WQ_MEM_RECLAIM); 1323 - #endif 1304 + sched->submit_wq = drm_sched_alloc_wq(args->name); 1324 1305 if (!sched->submit_wq) 1325 1306 return -ENOMEM; 1326 1307