STRUCT DRM_SCHED_JOB(9)
β¨ struct drm_sched_job(9) β¨
okay so bestie, welcome to the Kernel API Manual for struct drm_sched_job β literally the blueprint for "a job to be run by an entity" π
this is the glow-up version, no cap.
π¦ SYNOPSIS π¦
like, here's the whole struct, every single field, exactly as it lives in the header:
struct drm_sched_job {
ktime_t submit_ts;
struct drm_gpu_scheduler *sched;
struct drm_sched_fence *s_fence;
struct drm_sched_entity *entity;
struct drm_sched_entity_stats *entity_stats;
enum drm_sched_priority s_priority;
u32 credits;
unsigned int last_dependency;
atomic_t karma;
struct spsc_node queue_node;
struct list_head list;
union {
struct dma_fence_cb finish_cb;
struct work_struct work;
};
struct dma_fence_cb cb;
struct xarray dependencies;
};
π Members π
okay so let's go field by field, bestie, because every single one matters:
submit_tsβ when the job got pushed into the entity queue. the literal timestamp of "it's giving scheduled" β¨schedβ the scheduler this job is or will be scheduled on. gets set bydrm_sched_job_arm. valid untildrm_sched_backend_ops.free_jobhas finished. so like, don't touch it after that, periodt πs_fenceβ contains the fences for the scheduling of job. it's giving "hold the door" energy πͺentityβ the entity to which this job belongs. main character association, fr fr πentity_statsβ stats object reference held by the job and entity. keeping receipts on the metrics, iykyk πs_priorityβ the priority of the job. highkey important for queue order πcreditsβ the number of credits this job contributes to the scheduler. like, budget allocation but make it kernel πͺlast_dependencyβ tracks dependencies as they signal. lowkey the job's little dependency diary πkarmaβ increment on every hang caused by this job. if this exceeds the hang limit of the scheduler then the job is marked guilty and will not be scheduled further. literally the naughty list, no cap ππ«queue_nodeβ used to append this struct to the queue of jobs in an entity. the queue is giving linked-list realness πlistβ a job participates in a "pending" and "done" lists. both vibes, two lists, one job π{unnamed_union}β anonymous. mysterious. iconic. no name needed π«finish_cbβ the callback for the finished fence. like a little "we're done here" notification ποΈworkβ helper to reschedule job kill to different context. yes bestie, even the kill gets rescheduled πcbβ the callback for the parent fence ins_fence. the callback's callback, iykyk πdependenciesβ contains the dependencies asstruct dma_fencefor this job. seedrm_sched_job_add_dependencyanddrm_sched_job_add_implicit_dependencies. it's literally the job's whole relationship web πΈοΈ
πΈ Description πΈ
so a job is created by the driver using drm_sched_job_init, and then it should call drm_sched_entity_push_job once it wants the scheduler to schedule the job. like, create it, then yeet it into the scheduler. that's the whole flow, bestie β¨π«Ά
π SEE ALSO π
the whole squad, no cap:
- 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)enum drm_gpu_sched_stat(9)struct drm_sched_backend_ops(9)struct drm_gpu_scheduler(9)struct drm_sched_init_args(9)struct drm_sched_pending_job_iter(9)drm_sched_for_each_pending_job(9)
okay and that's the whole page, bestie β signed, sealed, delivered by the ./include/drm girlies, dated October 2026, and that's on periodt π
ππ¦
π¦ 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