At one point I thought I wanted to add a member to struct drm_sched_job. As I noticed there is a hole in the struct, I went to re-order some members to get rid of it (the hole), at which point I was greeted by a subtle bug cause by the frequent pattern of: job = to_drm_sched_job(spsc_queue_peek|pop(...)) Because to_drm_sched_job is a container of, it implies a lot of the scheduler (and amdgpu) assumes job->queue_node is the first struct element. Dare to change that, code will compile but weird things will happen at runtime. So I thought lets clean that up and remove that hardcoded sneaky assumption and that is what this series does. 1) Adds a helper so amdgpu can touch the scheduler internals a little bit less. 2) Removes the assumption job->queue_node must be the first element. 3) And finally removes the hole from struct drm_sched_job, fixing one instance of type confusion in passing too. Cc: Christian König <christian.koenig@xxxxxxx> Cc: Danilo Krummrich <dakr@xxxxxxxxxx> Cc: Matthew Brost <matthew.brost@xxxxxxxxx> Cc: Philipp Stanner <phasta@xxxxxxxxxx> Tvrtko Ursulin (4): drm/sched: Add job popping API drm/amdgpu: Use the new low level job popping helper drm/sched: Remove to_drm_sched_job internal helper drm/sched: Make the type of drm_sched_job->last_dependency consistent drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 +- drivers/gpu/drm/scheduler/sched_entity.c | 20 ++++---- drivers/gpu/drm/scheduler/sched_main.c | 10 ++-- include/drm/gpu_scheduler.h | 59 ++++++++++++++++-------- 4 files changed, 57 insertions(+), 37 deletions(-) -- 2.47.1