All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
To: Tejun Heo <tj@kernel.org>
Cc: phasta@kernel.org, dri-devel@lists.freedesktop.org,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>, Chia-I Wu <olvaffe@gmail.com>,
	Danilo Krummrich <dakr@kernel.org>,
	Matthew Brost <matthew.brost@intel.com>,
	kernel-dev@igalia.com
Subject: Re: [RFC 0/8] DRM scheduler kthread_worker for submission latency improvements
Date: Fri, 10 Jul 2026 13:29:19 +0100	[thread overview]
Message-ID: <250bfc53-e91b-4c48-9401-bbe636d3400b@igalia.com> (raw)
In-Reply-To: <19f0c3fe-7395-492f-b016-7a7a507da4f6@igalia.com>


On 09/07/2026 09:28, Tvrtko Ursulin wrote:
> 
> On 08/07/2026 17:24, Tvrtko Ursulin wrote:
> 
> 8<>
> 
>>> How big a hit is WQ_HIGHPRI vs. RT?
>>
>> I can measure that tomorrow or so. But so far I am not very optimistic 
>> about MIN_NICE ability to make a difference.
>>
>> Today I repeated the benchmarking Chia-I did originally, with the 
>> tweak of background load threads always being of normal priority and 
>> only varying the userspace Vulkan submit thread between normal, nice 
>> -1 and FIFO. Those three against three kernels - stock, this RFC 
>> capped to never go above MIN_NICE for the kthread_worker, and this RFC 
>> as is (so kthread_worker temporarily follows userspace FIFO).
>>
>> The results are that only following to FIFO brings interesting gains.
>>
>>          STOCK           --RFC         Full RFC
>>       .    N   RT    .     N    RT    .     N  RT
>>     M    28   32      35   36    26    23   19    19  17
>>   95%   211  537      69  276   186   426  151   284  30
>>   98%   843  993     804  942  1277  1842  982  1028  34
>>
>>       STOCK = 7.1.0
>>       --RFC = This RFC, but kthread_worker capped and MIN_NICE
>>    Full RFC = RFC as is, kthread_worker goes up to FIFO
>>
>>   M = Median
>>
>>    . = Userspace submit thread SCHED_OTHER
>>    N = -||= nice -1
>>   RT = -||- FIFO 1
>>
>> All numbers are latencies between job passed to DRM scheduler to DRM 
>> scheduler passing it to the GPU. In micro seconds.
>>
>> I'll report back with WQ_HIGHPRI results as soon as possible.
> 
> I made panthor set WQ_HIGHPRI on stock 7.1 and tested normal, nice and 
> FIFO vulkan submit thread. As expected I do not see a clear improvement:
> 
>          .    N    RT
>     M   27   28    32
>   95%  163  246   809
>   98%  924  991  1882
> 
> This makes it seem that the 95-th percentile is perhaps better for 
> normal and re-niced userspace thread cases, but it may also be noise and 
> I would need to do many more and longer runs on each config to be sure. 
> 98-th percentile spikes are still there. Also, even if 95% would be a 
> real improvement they are still an order of magnitude above median so I 
> do not think it is worth spending much more time on benchmarking that 
> option.

To add another data point, today I did a quick WQ_RTPRI experiment.

That allows eliminating both the kthread_worker pool complications and 
priority inheritance from this series by allowing creation of SCHED_FIFO 
workqueues. It reduces the series to just two patches. One to add 
WQ_RTPRI and second to make panthor use it for realtime queues.

In the core code I capped max_active for those to num_online_cpus() / 2, 
although I am not sure Tejun if that is what you had in mind when you 
said it might be acceptable if the number of workers would be bound? I 
am also not sure if this will limit the system number or just for 
individual worker. If only the latter than further improvements will 
obviously be required.

On top of that, for the panthor use case we agreed that two threads is 
good enough so that is what the driver requests as the upper bound.

Overall flow is that when userspace requests 
VK_QUEUE_GLOBAL_PRIORITY_REALTIME (for which CAP_SYS_NICE is required 
btw), that queue goes to the DRM scheduler panthor created a WQ_RTPRI 
workqueue for. Lower priority Vulkan queues go to lower priority 
workqueues so there is no danger of normal priority clients over-using 
the RT queues.

Submit latency wise this is still completely effective. Median latency 
is 14us and 95 and 98-th percentiles are 23us and 25us respectively.

So the question is whether something like this is acceptable to 
workqueue core? If so, I can send it as a proper RFC and go from there.

Regards,

Tvrtko

P.S.
My WIP branch implementing this:
https://cgit.freedesktop.org/~tursulin/drm-intel/log/?h=wqrt-panthor


  reply	other threads:[~2026-07-10 12:29 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 14:37 [RFC 0/8] DRM scheduler kthread_worker for submission latency improvements Tvrtko Ursulin
2026-07-02 14:37 ` [RFC 1/8] drm/panthor: Remove redundant drm_sched_job_cleanup() from the .free_job callback Tvrtko Ursulin
2026-07-03 15:00   ` Steven Price
2026-07-09 10:05     ` Tvrtko Ursulin
2026-07-09 10:15       ` Boris Brezillon
2026-07-09 12:16         ` Tvrtko Ursulin
2026-07-02 14:37 ` [RFC 2/8] drm/panthor: Use separate workqueue for DRM scheduler Tvrtko Ursulin
2026-07-02 15:31   ` Boris Brezillon
2026-07-06 12:03     ` Tvrtko Ursulin
2026-07-06 14:18       ` Boris Brezillon
2026-07-08 16:47         ` Tvrtko Ursulin
2026-07-09  6:45           ` Boris Brezillon
2026-07-09 10:56             ` Tvrtko Ursulin
2026-07-09 12:19               ` Boris Brezillon
2026-07-09 14:33                 ` Tvrtko Ursulin
2026-07-09 15:24                   ` Boris Brezillon
2026-07-02 14:37 ` [RFC 3/8] drm/sched: Use generic naming for workqueue helpers Tvrtko Ursulin
2026-07-02 14:37 ` [RFC 4/8] drm/xe: Convert to per gt scheduler workers Tvrtko Ursulin
2026-07-03  9:06   ` Matthew Brost
2026-07-06 12:27     ` Tvrtko Ursulin
2026-07-06 23:14       ` Matthew Brost
2026-07-08 16:35         ` Tvrtko Ursulin
2026-07-08 19:32           ` Matthew Brost
2026-07-09 11:35             ` Tvrtko Ursulin
2026-07-09 11:45               ` Matthew Brost
2026-07-09 12:05                 ` Tvrtko Ursulin
2026-07-02 14:37 ` [RFC 5/8] drm: Wrap DRM scheduler worker in own abstraction Tvrtko Ursulin
2026-07-02 14:37 ` [RFC 6/8] drm/sched: Convert the scheduler job submission to kthread_worker Tvrtko Ursulin
2026-07-02 14:37 ` [RFC 7/8] drm/sched: Add ability to change drm_sched_worker priority Tvrtko Ursulin
2026-07-02 14:37 ` [RFC 8/8] drm/sched: Notify worker of the entity submission priority Tvrtko Ursulin
2026-07-03  8:52 ` [RFC 0/8] DRM scheduler kthread_worker for submission latency improvements Philipp Stanner
2026-07-06 12:20   ` Tvrtko Ursulin
2026-07-06 19:36     ` Tejun Heo
2026-07-08 16:24       ` Tvrtko Ursulin
2026-07-09  8:28         ` Tvrtko Ursulin
2026-07-10 12:29           ` Tvrtko Ursulin [this message]
2026-07-10 16:11             ` Tejun Heo
2026-07-10 18:29               ` Matthew Brost
2026-07-03  9:22 ` Matthew Brost
2026-07-06 12:41   ` Tvrtko Ursulin
2026-07-06 22:54     ` Matthew Brost
2026-07-07  7:12       ` Matthew Brost
2026-07-08 17:01         ` Tvrtko Ursulin
2026-07-08 20:46           ` Matthew Brost
2026-07-08 22:39             ` Matthew Brost
2026-07-09  6:52             ` Boris Brezillon
2026-07-09  7:25             ` Boris Brezillon
2026-07-09  7:55               ` Matthew Brost
2026-07-09 10:08                 ` Boris Brezillon

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=250bfc53-e91b-4c48-9401-bbe636d3400b@igalia.com \
    --to=tvrtko.ursulin@igalia.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=liviu.dudau@arm.com \
    --cc=matthew.brost@intel.com \
    --cc=olvaffe@gmail.com \
    --cc=phasta@kernel.org \
    --cc=steven.price@arm.com \
    --cc=tj@kernel.org \
    /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.