STRUCT DRM_GPU_SCHEDULER(9)
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 tonum_user_rqsfor FIFO and RR and1for the FAIR policy. periodt. πnum_user_rqsβ Number of run-queues. This is at mostDRM_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 sizenum_rqs; yes, that semicolon is in the building. π¦job_scheduledβ oncedrm_sched_entity_flushis 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 queuework_run_jobandwork_free_job. π§timeout_wqβ workqueue used to queuework_tdr. β°avg_job_usβ Average job duration. the literal average-job-time icon. πwork_run_jobβ work which callsrun_jobop of each scheduler. go off, run that job. π₯work_free_jobβ work which callsfree_jobop of each scheduler. cleanup era. π§Ήwork_tdrβ schedules a delayed call todrm_sched_job_timedoutafter 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 thepending_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 ofwork_run_jobonsubmit_wq. hold up, bestie β pause the queuing. βown_submit_wqβ scheduler owns allocation ofsubmit_wq. itβs not borrowing it; it owns it. πdevβ systemstruct 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 π
- Kernel file
./include/drm/gpu_scheduler.h DRM_SCHED_FENCE_DONT_PIPELINE(9)DRM_SCHED_FENCE_FLAG_HAS_DEADLINE_BIT(9)struct drm_sched_entity(9)struct drm_sched_rq(9)struct drm_sched_fence(9)struct drm_sched_job(9)enum drm_gpu_sched_stat(9)struct drm_sched_backend_ops(9)struct drm_sched_init_args(9)struct drm_sched_pending_job_iter(9)drm_sched_for_each_pending_job(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms