mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Pierre-Eric Pelloux-Prayer <pierre-eric@damsy.net>,
	Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	Oded Gabbay <ogabbay@kernel.org>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Simona Vetter" <simona@ffwll.ch>,
	"Pierre-Eric Pelloux-Prayer" <pierre-eric.pelloux-prayer@amd.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"David Airlie" <airlied@gmail.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Philipp Stanner" <phasta@kernel.org>
Subject: Re: [PATCH v1 2/2] drm/sched: limit sched score update to jobs change
Date: Fri, 26 Sep 2025 09:24:08 +0100	[thread overview]
Message-ID: <f5a7ceb4-2313-48b9-bf75-628e9ad91757@ursulin.net> (raw)
In-Reply-To: <5183ed88-1634-42c2-9bd8-ed0e626f877b@damsy.net>


On 26/09/2025 09:20, Pierre-Eric Pelloux-Prayer wrote:
> Hi,
> 
> Le 01/09/2025 à 11:20, Tvrtko Ursulin a écrit :
>>
>>
>> + Tomeu and Oded
>>
>> On 22/08/2025 14:43, Pierre-Eric Pelloux-Prayer wrote:
>>> Currently, the scheduler score is incremented when a job is pushed to an
>>> entity and when an entity is attached to the scheduler.
>>>
>>> This leads to some bad scheduling decision where the score value is
>>> largely made of idle entities.
>>>
>>> For instance, a scenario with 2 schedulers and where 10 entities submit
>>> a single job, then do nothing, each scheduler will probably end up with
>>> a score of 5.
>>> Now, 5 userspace apps exit, so their entities will be dropped. In
>>> the worst case, these apps' entities where all attached to the same
>>> scheduler and we end up with score=5 (the 5 remaining entities) and
>>> score=0, despite the 2 schedulers being idle.
>>> When new entities show up, they will all select the second scheduler
>>> based on its low score value, instead of alternating between the 2.
>>>
>>> Some amdgpu rings depended on this feature, but the previous commit
>>> implemented the same thing in amdgpu directly so it can be safely
>>> removed from drm/sched.
>>>
>>> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux- 
>>> prayer@amd.com>
>>> ---
>>>   drivers/gpu/drm/scheduler/sched_main.c | 2 --
>>>   1 file changed, 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/ 
>>> drm/ scheduler/sched_main.c
>>> index 5a550fd76bf0..e6d232a8ec58 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>>> @@ -206,7 +206,6 @@ void drm_sched_rq_add_entity(struct drm_sched_rq 
>>> *rq,
>>>       if (!list_empty(&entity->list))
>>>           return;
>>> -    atomic_inc(rq->sched->score);
>>>       list_add_tail(&entity->list, &rq->entities);
>>>   }
>>> @@ -228,7 +227,6 @@ void drm_sched_rq_remove_entity(struct 
>>> drm_sched_rq *rq,
>>>       spin_lock(&rq->lock);
>>> -    atomic_dec(rq->sched->score);
>>>       list_del_init(&entity->list);
>>>       if (rq->current_entity == entity)
>>
>> LGTM.
>>
>> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
>>
> 
> Thanks.
> 
>> Only detail is, I did a revisit of the scheduler users and it looks 
>> like the new rocket driver is the only one other than amdgpu which 
>> passes a list of more than one scheduler to drm_sched_entity_init. I 
>> don't *think* it would be affected though. It would still pick the 
>> least loaded (based on active jobs) scheduler at job submit time. 
>> Unless there is some hidden behaviour in that driver where it would be 
>> important to consider number of entities too. Anyway, it would be good 
>> for rocket driver to double-check and ack.
>>
> 
> Tomeu, Oded: any concerns about this change?

Tomeu acked it in case you missed it:

https://lore.kernel.org/dri-devel/20250822134348.6819-1-pierre-eric.pelloux-prayer@amd.com/T/#m4efa0d69211b2bb378cfb302e459faa30e57f58c

Regards,

Tvrtko


  reply	other threads:[~2025-09-26  8:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22 13:43 [PATCH v1 1/2] drm/amdgpu: increment share sched score on entity selection Pierre-Eric Pelloux-Prayer
2025-08-22 13:43 ` [PATCH v1 2/2] drm/sched: limit sched score update to jobs change Pierre-Eric Pelloux-Prayer
2025-08-25 13:13   ` Philipp Stanner
2025-09-01 13:14     ` Pierre-Eric Pelloux-Prayer
2025-09-02  6:21       ` Philipp Stanner
2025-09-01  9:20   ` Tvrtko Ursulin
2025-09-05 13:39     ` Tomeu Vizoso
2025-09-26  8:20     ` Pierre-Eric Pelloux-Prayer
2025-09-26  8:24       ` Tvrtko Ursulin [this message]
2025-09-26  8:26         ` Pierre-Eric Pelloux-Prayer
2025-09-01  9:02 ` [PATCH v1 1/2] drm/amdgpu: increment share sched score on entity selection Tvrtko Ursulin
2025-09-03  8:48   ` Pierre-Eric Pelloux-Prayer
2025-09-05 14:33 ` Christian König

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=f5a7ceb4-2313-48b9-bf75-628e9ad91757@ursulin.net \
    --to=tursulin@ursulin.net \
    --cc=airlied@gmail.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=ogabbay@kernel.org \
    --cc=phasta@kernel.org \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=pierre-eric@damsy.net \
    --cc=simona@ffwll.ch \
    --cc=tomeu@tomeuvizoso.net \
    --cc=tzimmermann@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®