STRUCT DRM_SCHED_JOB(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 by drm_sched_job_arm. valid until drm_sched_backend_ops.free_job has 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 in s_fence. the callback's callback, iykyk πŸ”
  • dependencies β€” contains the dependencies as struct dma_fence for this job. see drm_sched_job_add_dependency and drm_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:


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