Lock-free dmix considered harmful
Takashi Iwai
tiwai at suse.de
Fri Jun 19 19:21:25 CEST 2020
On Tue, 19 May 2020 15:51:56 +0200,
Jaroslav Kysela wrote:
>
> Dne 19. 05. 20 v 15:46 Takashi Iwai napsal(a):
> >
> >> Because of these reasons I think it would be better to drop the lock-free implementation entirely and just use the existing non-concurrent architecture-independent implementation from pcm_dmix_generic.c. Aside from being faster, it would also eliminate a lot of architecture-dependent code and inline assembly. Should I submit a patch for this?
> >
> > The advantage of lockless dmix implementation isn't about its CPU usage
> > but the nature where a stream isn't prevented by other streams, which
> > assures the very low latency, too. That is, with the generic dmix, a
> > stream can be still halted when another stream stalls in the middle,
> > and there is no way to recover from it.
> >
> > So, IMO, we can start with a dynamic configuration to choose the
> > behavior and add a configure option to choose the implementations.
> > The default behavior should be still an open question, though.
>
> I fully agree here.
OK, I implemented a couple of patches for this.
The default behavior is a bigger question and I chose disabling the
lockless for less CPU usage. But it's selectable via configure option
or the runtime asoundrc setup (there is already an option
dmix.direct_memory_access).
Takashi
More information about the Alsa-devel
mailing list