Sync audio stutters

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Wed Feb 6 05:40:23 PST 2008


Hey,

I'd like to commit this patch in a couple of days if nobody objects.  I 
think this fixes the "audio stutters" on machines with a lot of memory.

cheers
  simon
Index: kern/vfs_mount.c
===================================================================
RCS file: /home/dcvs/src/sys/kern/vfs_mount.c,v
retrieving revision 1.30
diff -u -p -r1.30 vfs_mount.c
--- kern/vfs_mount.c    5 Jan 2008 14:02:38 -0000       1.30
+++ kern/vfs_mount.c    5 Feb 2008 01:18:21 -0000
@@ -906,6 +906,7 @@ vmntvnodescan(
        struct vnode *vp;
        int r = 0;
        int maxcount = 1000000;
+       int count = 0;
        lwkt_gettoken(&ilock, &mntvnode_token);

@@ -981,12 +982,24 @@ vmntvnodescan(
                                break;
                }
+next:
+               /*
+                * Yield after some processing.  Depending on the number
+                * of vnodes, we might wind up running for a long time.
+                * Because threads are not preemptable, time critical
+                * userland processes might starve.  Give them a chance
+                * now and then.
+                */
+               if (++count == 10000) {
+                       lwkt_yield();
+                       count = 0;
+               }
+
                /*
                 * Iterate.  If the vnode was ripped out from under us
                 * info.vp will already point to the next vnode, otherwise
                 * we have to obtain the next valid vnode ourselves.
                 */
-next:
                if (info.vp == vp)
                        info.vp = TAILQ_NEXT(vp, v_nmntvnodes);
        }
--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \





More information about the Kernel mailing list