Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Dec 2012 13:14:12 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r244534 - in head/sys: kern ufs/ffs
Message-ID:  <201212211314.qBLDECrk066247@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri Dec 21 13:14:12 2012
New Revision: 244534
URL: http://svnweb.freebsd.org/changeset/base/244534

Log:
  Fixup r218424: uio_yield() was scaling directly to userland priority.
  When kern_yield() was introduced with the possibility to specify
  a new priority, the behaviour changed by not lowering priority at all
  in the consumers, making the yielding mechanism highly ineffective for
  high priority kthreads like bufdaemon, syncer, vlrudaemon, etc.
  There are no evidences that consumers could bear with such change in
  semantic and this situation could finally lead to bugs similar to the
  ones fixed in r244240.
  Re-specify userland pri for kthreads involved.
  
  Tested by:	pho
  Reviewed by:	kib, mdf
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Fri Dec 21 11:08:44 2012	(r244533)
+++ head/sys/kern/vfs_bio.c	Fri Dec 21 13:14:12 2012	(r244534)
@@ -2209,7 +2209,7 @@ buf_daemon()
 		while (numdirtybuffers > lodirtybuffers) {
 			if (buf_do_flush(NULL) == 0)
 				break;
-			kern_yield(PRI_UNCHANGED);
+			kern_yield(PRI_USER);
 		}
 		lodirtybuffers = lodirtysave;
 

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Fri Dec 21 11:08:44 2012	(r244533)
+++ head/sys/kern/vfs_mount.c	Fri Dec 21 13:14:12 2012	(r244534)
@@ -1724,7 +1724,7 @@ __mnt_vnode_next(struct vnode **mvp, str
 	KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
 	if (should_yield()) {
 		MNT_IUNLOCK(mp);
-		kern_yield(PRI_UNCHANGED);
+		kern_yield(PRI_USER);
 		MNT_ILOCK(mp);
 	}
 	vp = TAILQ_NEXT(*mvp, v_nmntvnodes);

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Fri Dec 21 11:08:44 2012	(r244533)
+++ head/sys/kern/vfs_subr.c	Fri Dec 21 13:14:12 2012	(r244534)
@@ -741,7 +741,7 @@ next_iter:
 			continue;
 		MNT_IUNLOCK(mp);
 yield:
-		kern_yield(PRI_UNCHANGED);
+		kern_yield(PRI_USER);
 relock_mnt:
 		MNT_ILOCK(mp);
 	}
@@ -853,7 +853,7 @@ vnlru_proc(void)
 			vnlru_nowhere++;
 			tsleep(vnlruproc, PPAUSE, "vlrup", hz * 3);
 		} else
-			kern_yield(PRI_UNCHANGED);
+			kern_yield(PRI_USER);
 	}
 }
 
@@ -4635,7 +4635,7 @@ __mnt_vnode_next_all(struct vnode **mvp,
 	struct vnode *vp;
 
 	if (should_yield())
-		kern_yield(PRI_UNCHANGED);
+		kern_yield(PRI_USER);
 	MNT_ILOCK(mp);
 	KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
 	vp = TAILQ_NEXT(*mvp, v_nmntvnodes);
@@ -4784,7 +4784,7 @@ __mnt_vnode_next_active(struct vnode **m
 {
 
 	if (should_yield())
-		kern_yield(PRI_UNCHANGED);
+		kern_yield(PRI_USER);
 	mtx_lock(&vnode_free_list_mtx);
 	return (mnt_vnode_next_active(mvp, mp));
 }

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Fri Dec 21 11:08:44 2012	(r244533)
+++ head/sys/ufs/ffs/ffs_softdep.c	Fri Dec 21 13:14:12 2012	(r244534)
@@ -1569,7 +1569,7 @@ softdep_process_worklist(mp, full)
 		 */
 		if (should_yield()) {
 			FREE_LOCK(&lk);
-			kern_yield(PRI_UNCHANGED);
+			kern_yield(PRI_USER);
 			bwillwrite();
 			ACQUIRE_LOCK(&lk);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212211314.qBLDECrk066247>