STRUCT DRM_GPU_SCHEDULER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

struct drm_gpu_scheduler(9) πŸ’–

okay so bestie, this one is from the Kernel API Manual and it is literally the blueprint for a scheduler instance’s very own data. no cap, it’s giving β€œone struct to hold all the scheduler things.” main character energy fr fr. πŸŽ€


🌸 NAME 🌸

struct drm_gpu_scheduler β€” scheduler instance-specific data. that’s the whole name vibe, and yes, every little field matters. πŸ’…


✨ SYNOPSIS ✨

here’s the struct in all its glory β€” copy it exactly, bestie, no β€œfixing” the spacing or renaming anything:

       struct drm_gpu_scheduler {
           const struct drm_sched_backend_ops      *ops;
           u32 credit_limit;
           atomic_t credit_count;
           long timeout;
           const char                      *name;
           u32 num_rqs;
           u32 num_user_rqs;
           struct drm_sched_rq             **sched_rq;
           wait_queue_head_t job_scheduled;
           atomic64_t job_id_count;
           struct workqueue_struct         *submit_wq;
           struct workqueue_struct         *timeout_wq;
           struct ewma_drm_sched_avgtime   avg_job_us;
           struct work_struct              work_run_job;
           struct work_struct              work_free_job;
           struct delayed_work             work_tdr;
           struct list_head                pending_list;
           spinlock_t job_list_lock;
           int hang_limit;
           atomic_t *score;
           atomic_t _score;
           bool ready;
           bool free_guilty;
           bool pause_submit;
           bool own_submit_wq;
           struct device                   *dev;
        };

🫢 Members 🫢

  • ops β€” backend operations provided by the driver. the driver’s lil’ checklist of backend behavior, basically. πŸ’–
  • credit_limit β€” the credit limit of this scheduler. πŸ”₯
  • credit_count β€” the current credit count of this scheduler. ⭐
  • timeout β€” the time after which a job is removed from the scheduler. yes, the clock is ticking, bestie. 😭
  • name β€” name of the ring for which this scheduler is being used. iconic little name tag energy. πŸŽ€
  • num_rqs β€” Equal to num_user_rqs for FIFO and RR and 1 for the FAIR policy. periodt. πŸ’…
  • num_user_rqs β€” Number of run-queues. This is at most DRM_SCHED_PRIORITY_COUNT, as there’s usually one run-queue per priority, but could be less. so close to the max, but not always. πŸ‘‘
  • sched_rq β€” An allocated array of run-queues of size num_rqs; yes, that semicolon is in the building. πŸ¦‹
  • job_scheduled β€” once drm_sched_entity_flush is called the scheduler waits on this wait queue until all the scheduled jobs are finished. the β€œwait for everybody to finish” queue, fr fr. 🌸
  • job_id_count β€” used to assign unique id to the each job. every job gets its own little id moment. ✨
  • submit_wq β€” workqueue used to queue work_run_job and work_free_job. 🧚
  • timeout_wq β€” workqueue used to queue work_tdr. ⏰
  • avg_job_us β€” Average job duration. the literal average-job-time icon. πŸ“Š
  • work_run_job β€” work which calls run_job op of each scheduler. go off, run that job. πŸ”₯
  • work_free_job β€” work which calls free_job op of each scheduler. cleanup era. 🧹
  • work_tdr β€” schedules a delayed call to drm_sched_job_timedout after the timeout interval is over. the dramatic delayed entrance, honestly. πŸ’€
  • pending_list β€” the list of jobs which are currently in the job queue. the β€œcurrently pending” clique. πŸ’œ
  • job_list_lock β€” lock to protect the pending_list. protect the list at all costs. πŸ›‘οΈ
  • hang_limit β€” once the hangs by a job crosses this limit then it is marked guilty and it will no longer be considered for scheduling. not the guilty verdict 😭 β€” it’s no longer considered for scheduling, periodt.
  • score β€” score to help loadbalancer pick a idle sched. yes, β€œa idle sched” β€” we’re keeping the details, bestie. 🌈
  • _score β€” score used when the driver doesn’t provide one. the backup-score main character. ⭐
  • ready β€” marks if the underlying HW is ready to work. vibe check for the hardware. βœ…
  • free_guilty β€” A hit to time out handler to free the guilty job. 🫢
  • pause_submit β€” pause queuing of work_run_job on submit_wq. hold up, bestie β€” pause the queuing. βœ‹
  • own_submit_wq β€” scheduler owns allocation of submit_wq. it’s not borrowing it; it owns it. πŸ‘‘
  • dev β€” system struct device. the device link-up, fr fr. πŸ”Œ

✨ Description ✨

One scheduler is implemented for each hardware ring. that’s the big-picture tea: one scheduler per hardware ring, no cap. πŸŒ€


πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’‹ source/version: ./include/drm, date: October 2026. that’s the cute lil’ sign-off, bestie β€” now go read the whole scheduler struct like the icon you are. 🫢✨

πŸ“¦ where this page comes from