STRUCT DRM_SCHED_FENCE(9)
π struct drm_sched_fence(9) β the Kernel API Manual glow-up
okay bestie, so you're poking around in drm_sched_fence(9) β that's the DRM scheduler fence page, and honestly? It's giving "unsung hero of job scheduling" and we're gonna stan. β¨
This page lives in the Kernel API Manual, and it's all about the fences corresponding to the scheduling of a job. That's the whole NAME situation right there. π
β¨ SYNOPSIS β¨
no cap, here's the struct in all its glory β copy it exactly, don't touch a single character:
struct drm_sched_fence {
struct dma_fence scheduled;
struct dma_fence finished;
ktime_t deadline;
struct dma_fence *parent;
struct drm_gpu_scheduler *sched;
spinlock_t lock;
void *owner;
uint64_t drm_client_id;
};
she's structured, she's specific, she's iconic. π
π«Ά Members π«Ά
the way each of these fields has a whole personality⦠let's go one by one:
scheduledβ this fence is what will be signaled by the scheduler when the job is scheduled. early vibes, first signal, main character energy for the "we're doing this" moment. πΈfinishedβ this fence is what will be signaled by the scheduler when the job is completed. the grand finale, the "ate and left no crumbs" fence. π
ok so listen β when you're setting up an out fence for the job, use this one, because it's available immediately upondrm_sched_job_init. meanwhile the fence returned by the driver fromrun_jobwon't even be created until the dependencies have resolved. so yeah,finishedis right there from the jump and that's why she's the one you want for an out fence. π¦
deadlineβ aktime_tdeadline set ondrm_sched_fence.finishedwhich potentially needs to be propagated todrm_sched_fence.parent. so she's not just a deadline, she's a deadline with responsibilities, potentially. β°parentβ the fence returned bydrm_sched_backend_ops.run_jobwhen scheduling the job on hardware. we signal thedrm_sched_fence.finishedfence onceparentis signalled. it's literally the whole "wait for your elder to move first" situation. πschedβ the scheduler instance to which the job having this struct belongs to. your job's home base, its little scheduler family. πlockβ the lock used by thescheduledand thefinishedfences. shared custody of the lock, and honestly? mutual respect. πownerβ job owner for debugging. so when things go weird you know who did this. πdrm_client_idβ the client_id of thedrm_filewhich owns the job. the receipts, the paper trail, the whole "iykyk" of job ownership. π§Ύ
π SEE ALSO π
go read these next, bestie, they're all part of the same friend group:
- 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_job(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)
fr fr: every field above is doing real work and none of them are optional reading. slay responsibly. π
and that's the whole page, bestie β sourced from ./include/drm, dated October 2026, and yeah, struct drm_sched_fence(9) absolutely ate. 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