[alsa-devel] [PATCH 2/2] ALSA: pcm: Add cond_resched() in OSS read/write loop
Takashi Iwai
tiwai at suse.de
Fri Apr 6 15:34:12 CEST 2018
The PCM OSS read/write loops may take too long occasionally when a
huge size of data is given. Add cond_resched() to become more system-
friendlier.
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
sound/core/oss/pcm_oss.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 5e009a444d9d..54984119c0b3 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1452,6 +1452,7 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
break;
}
tmp = 0;
+ cond_resched();
}
atomic_dec(&runtime->oss.rw_ref);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
@@ -1547,6 +1548,7 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
break;
}
tmp = 0;
+ cond_resched();
}
atomic_dec(&runtime->oss.rw_ref);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
--
2.16.3
More information about the Alsa-devel
mailing list