From: "Maíra Canal" <mcanal@igalia.com>
To: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: kernel-dev@igalia.com,
"Christian König" <christian.koenig@amd.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Matthew Brost" <matthew.brost@intel.com>,
"Philipp Stanner" <phasta@kernel.org>
Subject: Re: [PATCH v5 06/16] drm/sched: Consolidate drm_sched_rq_select_entity_rr
Date: Fri, 4 Jul 2025 10:32:01 -0300 [thread overview]
Message-ID: <2dfd7d95-8cad-4e11-a363-706a9293a6ae@igalia.com> (raw)
In-Reply-To: <20250623122746.46478-7-tvrtko.ursulin@igalia.com>
Hi Tvrtko,
On 23/06/25 09:27, Tvrtko Ursulin wrote:
> Extract out two copies of the identical code to function epilogue to make
> it smaller and more readable.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 48 +++++++++++---------------
> 1 file changed, 20 insertions(+), 28 deletions(-)
>
I'd consider dropping this patch. The function
drm_sched_rq_select_entity_rr() will be deleted in the next patch
anyway. Therefore, we could land 7/16 in drm-misc-next (even before
landing fair scheduling) and get rid of drm_sched_rq_select_entity_rr().
Best Regards,
- Maíra
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 0627a82c02dc..436d58073823 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -263,38 +263,14 @@ drm_sched_rq_select_entity_rr(struct drm_gpu_scheduler *sched,
> entity = rq->current_entity;
> if (entity) {
> list_for_each_entry_continue(entity, &rq->entities, list) {
> - if (drm_sched_entity_is_ready(entity)) {
> - /* If we can't queue yet, preserve the current
> - * entity in terms of fairness.
> - */
> - if (!drm_sched_can_queue(sched, entity)) {
> - spin_unlock(&rq->lock);
> - return ERR_PTR(-ENOSPC);
> - }
> -
> - rq->current_entity = entity;
> - reinit_completion(&entity->entity_idle);
> - spin_unlock(&rq->lock);
> - return entity;
> - }
> + if (drm_sched_entity_is_ready(entity))
> + goto found;
> }
> }
>
> list_for_each_entry(entity, &rq->entities, list) {
> - if (drm_sched_entity_is_ready(entity)) {
> - /* If we can't queue yet, preserve the current entity in
> - * terms of fairness.
> - */
> - if (!drm_sched_can_queue(sched, entity)) {
> - spin_unlock(&rq->lock);
> - return ERR_PTR(-ENOSPC);
> - }
> -
> - rq->current_entity = entity;
> - reinit_completion(&entity->entity_idle);
> - spin_unlock(&rq->lock);
> - return entity;
> - }
> + if (drm_sched_entity_is_ready(entity))
> + goto found;
>
> if (entity == rq->current_entity)
> break;
> @@ -303,6 +279,22 @@ drm_sched_rq_select_entity_rr(struct drm_gpu_scheduler *sched,
> spin_unlock(&rq->lock);
>
> return NULL;
> +
> +found:
> + if (!drm_sched_can_queue(sched, entity)) {
> + /*
> + * If scheduler cannot take more jobs signal the caller to not
> + * consider lower priority queues.
> + */
> + entity = ERR_PTR(-ENOSPC);
> + } else {
> + rq->current_entity = entity;
> + reinit_completion(&entity->entity_idle);
> + }
> +
> + spin_unlock(&rq->lock);
> +
> + return entity;
> }
>
> /**
next prev parent reply other threads:[~2025-07-04 13:32 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 12:27 [PATCH v5 00/16] Fair DRM scheduler Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 01/16] drm/sched: Add some scheduling quality unit tests Tvrtko Ursulin
2025-06-24 8:27 ` kernel test robot
2025-06-23 12:27 ` [PATCH v5 02/16] drm/sched: Add some more " Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 03/16] drm/sched: De-clutter drm_sched_init Tvrtko Ursulin
2025-07-04 12:59 ` Philipp Stanner
2025-07-04 13:02 ` Tvrtko Ursulin
2025-07-04 13:08 ` Maíra Canal
2025-06-23 12:27 ` [PATCH v5 04/16] drm/sched: Avoid double re-lock on the job free path Tvrtko Ursulin
2025-07-04 12:29 ` Maíra Canal
2025-07-04 12:56 ` Philipp Stanner
2025-07-04 13:30 ` Tvrtko Ursulin
2025-07-04 13:59 ` Philipp Stanner
2025-07-04 15:14 ` Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 05/16] drm/sched: Consolidate drm_sched_job_timedout Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 06/16] drm/sched: Consolidate drm_sched_rq_select_entity_rr Tvrtko Ursulin
2025-07-04 13:32 ` Maíra Canal [this message]
2025-07-04 13:43 ` Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 07/16] drm/sched: Implement RR via FIFO Tvrtko Ursulin
2025-07-04 13:18 ` Maíra Canal
2025-07-04 13:37 ` Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 08/16] drm/sched: Consolidate entity run queue management Tvrtko Ursulin
2025-07-04 13:51 ` Maíra Canal
2025-07-04 15:32 ` Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 09/16] drm/sched: Move run queue related code into a separate file Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 10/16] drm/sched: Free all finished jobs at once Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 11/16] drm/sched: Account entity GPU time Tvrtko Ursulin
2025-07-04 14:18 ` Maíra Canal
2025-07-07 7:41 ` Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 12/16] drm/sched: Remove idle entity from tree Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 13/16] drm/sched: Add fair scheduling policy Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 14/16] drm/sched: Remove FIFO and RR and simplify to a single run queue Tvrtko Ursulin
2025-06-24 7:33 ` kernel test robot
2025-06-23 12:27 ` [PATCH v5 15/16] drm/sched: Queue all free credits in one worker invocation Tvrtko Ursulin
2025-06-23 12:27 ` [PATCH v5 16/16] drm/sched: Embed run queue singleton into the scheduler Tvrtko Ursulin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2dfd7d95-8cad-4e11-a363-706a9293a6ae@igalia.com \
--to=mcanal@igalia.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-dev@igalia.com \
--cc=matthew.brost@intel.com \
--cc=phasta@kernel.org \
--cc=tvrtko.ursulin@igalia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.