Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Only signal a pause change on a transition of a paus...



details:   https://anonhg.NetBSD.org/src/rev/9cee125f72c1
branches:  trunk
changeset: 828840:9cee125f72c1
user:      nat <nat%NetBSD.org@localhost>
date:      Sat Jan 06 23:15:36 2018 +0000

description:
Only signal a pause change on a transition of a pause change.

This addresses a problem found in audio/sox causing high cpu usage.

Path and analysis by Onno van der Linden.

diffstat:

 sys/dev/audio.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r c814db35a62c -r 9cee125f72c1 sys/dev/audio.c
--- a/sys/dev/audio.c   Sat Jan 06 21:16:36 2018 +0000
+++ b/sys/dev/audio.c   Sat Jan 06 23:15:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.446 2018/01/06 21:16:36 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.447 2018/01/06 23:15:36 nat Exp $  */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.446 2018/01/06 21:16:36 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.447 2018/01/06 23:15:36 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4762,14 +4762,18 @@
        }
 
        if (SPECIFIED_CH(p->pause)) {
-               vc->sc_mpr.pause = p->pause;
                pbus = !p->pause;
-               pausechange = true;
+               if (pbus != !vc->sc_mpr.pause) {
+                       vc->sc_mpr.pause = p->pause;
+                       pausechange = true;
+               }
        }
        if (SPECIFIED_CH(r->pause)) {
-               vc->sc_mrr.pause = r->pause;
                rbus = !r->pause;
-               pausechange = true;
+               if (rbus != !vc->sc_mrr.pause) {
+                       vc->sc_mrr.pause = r->pause;
+                       pausechange = true;
+               }
        }
 
        if (SPECIFIED(ai->mode)) {



Home | Main Index | Thread Index | Old Index