Yield the cpu in the kernel while iterating the list of the

vnodes belonging to the mountpoint. Also, yield when in the
softdep_process_worklist() even when we are not going to sleep due to
buffer drain.

It is believed that the ULE fixed the problem [1], but the yielding
seems to be needed at least for the 4BSD case.

Discussed:	on stable@, with bde
Reviewed by:	tegge, jeff [1]
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2008-03-23 13:45:24 +00:00
parent c58b62eff4
commit 1be222e9df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177528
3 changed files with 9 additions and 0 deletions

View file

@ -2008,6 +2008,12 @@ __mnt_vnode_next(struct vnode **mvp, struct mount *mp)
mtx_assert(MNT_MTX(mp), MA_OWNED);
KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
if ((*mvp)->v_yield++ == 500) {
MNT_IUNLOCK(mp);
(*mvp)->v_yield = 0;
uio_yield();
MNT_ILOCK(mp);
}
vp = TAILQ_NEXT(*mvp, v_nmntvnodes);
while (vp != NULL && vp->v_type == VMARKER)
vp = TAILQ_NEXT(vp, v_nmntvnodes);

View file

@ -124,6 +124,7 @@ struct vnode {
struct socket *vu_socket; /* v unix domain net (VSOCK) */
struct cdev *vu_cdev; /* v device (VCHR, VBLK) */
struct fifoinfo *vu_fifoinfo; /* v fifo (VFIFO) */
int vu_yield; /* yield count (VMARKER) */
} v_un;
/*
@ -178,6 +179,7 @@ struct vnode {
#define v_socket v_un.vu_socket
#define v_rdev v_un.vu_cdev
#define v_fifoinfo v_un.vu_fifoinfo
#define v_yield v_un.vu_yield
/* XXX: These are temporary to avoid a source sweep at this time */
#define v_object v_bufobj.bo_object

View file

@ -857,6 +857,7 @@ softdep_process_worklist(mp, full)
*/
if (loopcount++ % 128 == 0) {
FREE_LOCK(&lk);
uio_yield();
bwillwrite();
ACQUIRE_LOCK(&lk);
}