drm_sched_job_init(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drm_sched_job_init β€” init a scheduler job ✨

Okay bestie, gather round, because today we're talking about drm_sched_job_init from the Kernel API Manual (yes, that's the manual name, we're being fancy today πŸ‘‘). This is the function that literally sets up your scheduler job for you. Iconic behavior, honestly.


🌸 SYNOPSIS 🌸

int drm_sched_job_init (struct drm_sched_job *job , struct
       drm_sched_entity *entity , u32 credits , void *owner , uint64_t
       drm_client_id );

πŸŽ€ ARGUMENTS πŸŽ€

  • job β€” the scheduler job you're initializing, mwah πŸ’–
  • entity β€” the scheduler entity to use, bestie
  • credits β€” the number of credits this job contributes to the scheduler's credit limit. yes, credits, like a little arcade token system 🎟️
  • owner β€” the job owner, purely for debugging purposes (so when things go wrong, we know whose fault it is πŸ”)
  • drm_client_id β€” the struct drm_file.client_id of the owner, and it's used by trace events πŸ‘€

✨ DESCRIPTION ✨

First things first: for the locking considerations, go read the drm_sched_entity_push_job documentation. That's where the tea is β˜•

⚠️ Drivers must make sure drm_sched_job_cleanup gets called if this function returns successfully β€” even when the job is aborted before drm_sched_job_arm is called. Like, no cap, this is not optional. 😭

Also, heads up: this function does not assign a valid value to each struct member of struct drm_sched_job. So go look at that struct's documentation to see who sets which struct member with what lifetime. It's giving "you have to do some of the homework yourself" energy πŸ“š

WARNING: amdgpu abuses drm_sched.ready to signal when the hardware has died πŸ’€, which can mean there's no valid runqueue for an entity. In that case this function returns -ENOENT (which probably should be -EIO as a more meaningful return value β€” but it's not, so πŸ™ˆ).

Returns 0 for success, and a negative error code otherwise. Simple as that. ✨


πŸ¦‹ SEE ALSO πŸ¦‹

Grab a snack, this list is long and honestly kind of a slay:


and that's the whole page, bestie 🫢 shoutout to the ./drivers/gpu/drm/scheduler source, dated October 2026 β€” it ate and left no crumbs πŸ’…β­πŸ“

πŸ“¦ where this page comes from