ALSA: pcm: Allow aborting mutex lock at OSS read/write loops
authorTakashi Iwai <tiwai@suse.de>
Mon, 8 Jan 2018 13:03:53 +0000 (14:03 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 3 Mar 2018 15:50:57 +0000 (15:50 +0000)
commit84f7438d82337ab4cbb9f04d031a0005514f78b3
treec51d497495bfdd9a10334e9025aab64eb380bead
parent60c444b1c6af1cc3e0b34da57a5dd2d96d2d6da2
ALSA: pcm: Allow aborting mutex lock at OSS read/write loops

commit 900498a34a3ac9c611e9b425094c8106bdd7dc1c upstream.

PCM OSS read/write loops keep taking the mutex lock for the whole
read/write, and this might take very long when the exceptionally high
amount of data is given.  Also, since it invokes with mutex_lock(),
the concurrent read/write becomes unbreakable.

This patch tries to address these issues by replacing mutex_lock()
with mutex_lock_interruptible(), and also splits / re-takes the lock
at each read/write period chunk, so that it can switch the context
more finely if requested.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/core/oss/pcm_oss.c