Re: [PATCH 5/5] thunderbolt: stream: Add support for busy polling
Mika Westerberg <[email protected]>
| Newsgroups | org.kernel.vger.linux-usb |
|---|---|
| Message-ID | <[email protected]> |
Hi, On Wed, Jul 29, 2026 at 04:47:58PM +0200, Lukas Wunner wrote: > On Tue, Jul 28, 2026 at 01:51:41PM +0200, Mika Westerberg wrote: > > Using interrupts and scheduling workers increase latency so latency > > critical applications may want to avoid that. Make this possible in > > USB4STREAM by adding a new ConfigFS attribute: busy_poll that, when > > activated switches the rings to polling mode. The cost for lower latency > > is that this burns more CPU cycles and things like poll(2) cannot be > > used. > > Hm, would it be possible to auto-detect whether polling is more performant > for the current workload and automatically enable and disable it? > E.g. by counting the number of interrupts in a given interval and > enabling/disabling polling based on a high water mark / low water mark? > Those marks could then be finetuned from user space, but moving in and > out of polling automatically would be more desirable I think. Forcing > polling could be achieved by setting the water marks to a special value, > e.g. 0 or UINT_MAX. I think the applications that want the minimal latency and end up setting this will put it to the "minimal" anyway (because they don't tolerate any additional latencies caused by interrupts and the worker scheduling) and for the rest they can already tune this by setting non-default values to "throttling" attribute (eg. 0 to avoid it completely, makes latency lower while still keeping it from hogging the CPU fully). We can introduce auto-tuning mode afterwards as you suggest if it turns out to be wanted feature.