[PATCH 2/2] ALSA: pcm: Add cond_resched() in OSS read/write loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux