mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 05:27:07 +02:00
ALSA: pcm: Call snd_pcm_unlink() conditionally at closing
commit b51abed835 upstream.
Currently the PCM core calls snd_pcm_unlink() always unconditionally
at closing a stream. However, since snd_pcm_unlink() invokes the
global rwsem down, the lock can be easily contended. More badly, when
a thread runs in a high priority RT-FIFO, it may stall at spinning.
Basically the call of snd_pcm_unlink() is required only for the linked
streams that are already rare occasion. For normal use cases, this
code path is fairly superfluous.
As an optimization (and also as a workaround for the RT problem
above in normal situations without linked streams), this patch adds a
check before calling snd_pcm_unlink() and calls it only when needed.
Reported-by: Chanho Min <chanho.min@lge.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
026fdecbc3
commit
19054c1884
|
|
@ -2370,7 +2370,8 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
|
|||
|
||||
static void pcm_release_private(struct snd_pcm_substream *substream)
|
||||
{
|
||||
snd_pcm_unlink(substream);
|
||||
if (snd_pcm_stream_linked(substream))
|
||||
snd_pcm_unlink(substream);
|
||||
}
|
||||
|
||||
void snd_pcm_release_substream(struct snd_pcm_substream *substream)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user