drm_sched_job_init(9)
π 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, bestiecreditsβ 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β thestruct drm_file.client_idof 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 suredrm_sched_job_cleanupgets called if this function returns successfully β even when the job is aborted beforedrm_sched_job_armis 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:amdgpuabusesdrm_sched.readyto 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-EIOas 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:
- Kernel file
./drivers/gpu/drm/scheduler/sched_main.c Overview(9)Flow Control(9)sched_policy (int)(9)drm_sched_can_queue(9)drm_sched_run_job_queue(9)drm_sched_run_free_queue(9)drm_sched_job_done(9)drm_sched_job_done_cb(9)drm_sched_start_timeout(9)drm_sched_tdr_queue_imm(9)drm_sched_fault(9)drm_sched_suspend_timeout(9)drm_sched_resume_timeout(9)drm_sched_job_reinsert_on_false_timeout(9)drm_sched_stop(9)drm_sched_start(9)drm_sched_resubmit_jobs(9)drm_sched_job_arm(9)drm_sched_job_add_dependency(9)drm_sched_job_add_syncobj_dependency(9)drm_sched_job_add_resv_dependencies(9)drm_sched_job_add_implicit_dependencies(9)drm_sched_job_has_dependency(9)drm_sched_job_cleanup(9)drm_sched_wakeup(9)drm_sched_select_entity(9)drm_sched_get_finished_job(9)drm_sched_pick_best(9)drm_sched_free_job_work(9)drm_sched_run_job_work(9)drm_sched_init(9)drm_sched_fini(9)drm_sched_increase_karma(9)drm_sched_wqueue_ready(9)drm_sched_wqueue_stop(9)drm_sched_wqueue_start(9)drm_sched_is_stopped(9)drm_sched_job_is_signaled(9)
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
- 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