drm_sched_run_job_work() contains a comment which explains that an
entity being NULL means that there is no more work to do. It can,
however, also mean that there is work, but the scheduler doesn't have
enough credits to process the jobs right now.
Provide this detail in the comment.
Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
drivers/gpu/drm/scheduler/sched_main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index c39f0245e3a9..492e8af639db 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -1237,8 +1237,13 @@ static void drm_sched_run_job_work(struct work_struct *w)
/* Find entity with a ready job */
entity = drm_sched_select_entity(sched);
- if (!entity)
- return; /* No more work */
+ if (!entity) {
+ /*
+ * Either no more work to do, or the next ready job needs more
+ * credits than the scheduler has currently available.
+ */
+ return;
+ }
sched_job = drm_sched_entity_pop_job(entity);
if (!sched_job) {
--
2.49.0
On Tue, Oct 28, 2025 at 02:46:01PM +0100, Philipp Stanner wrote:
> drm_sched_run_job_work() contains a comment which explains that an
> entity being NULL means that there is no more work to do. It can,
> however, also mean that there is work, but the scheduler doesn't have
> enough credits to process the jobs right now.
>
> Provide this detail in the comment.
>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index c39f0245e3a9..492e8af639db 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -1237,8 +1237,13 @@ static void drm_sched_run_job_work(struct work_struct *w)
>
> /* Find entity with a ready job */
> entity = drm_sched_select_entity(sched);
> - if (!entity)
> - return; /* No more work */
> + if (!entity) {
> + /*
> + * Either no more work to do, or the next ready job needs more
> + * credits than the scheduler has currently available.
> + */
> + return;
> + }
>
> sched_job = drm_sched_entity_pop_job(entity);
> if (!sched_job) {
> --
> 2.49.0
>
On Wed, 2025-10-29 at 09:54 -0700, Matthew Brost wrote:
> On Tue, Oct 28, 2025 at 02:46:01PM +0100, Philipp Stanner wrote:
> > drm_sched_run_job_work() contains a comment which explains that an
> > entity being NULL means that there is no more work to do. It can,
> > however, also mean that there is work, but the scheduler doesn't have
> > enough credits to process the jobs right now.
> >
> > Provide this detail in the comment.
> >
> > Signed-off-by: Philipp Stanner <phasta@kernel.org>
>
> Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Applied to drm-misc-next.
Dropped the other patch.
Thx
P.
>
> > ---
> > drivers/gpu/drm/scheduler/sched_main.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> > index c39f0245e3a9..492e8af639db 100644
> > --- a/drivers/gpu/drm/scheduler/sched_main.c
> > +++ b/drivers/gpu/drm/scheduler/sched_main.c
> > @@ -1237,8 +1237,13 @@ static void drm_sched_run_job_work(struct work_struct *w)
> >
> > /* Find entity with a ready job */
> > entity = drm_sched_select_entity(sched);
> > - if (!entity)
> > - return; /* No more work */
> > + if (!entity) {
> > + /*
> > + * Either no more work to do, or the next ready job needs more
> > + * credits than the scheduler has currently available.
> > + */
> > + return;
> > + }
> >
> > sched_job = drm_sched_entity_pop_job(entity);
> > if (!sched_job) {
> > --
> > 2.49.0
> >
© 2016 - 2026 Red Hat, Inc.