From owner-freebsd-hackers Fri Oct 30 23:47:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA25265 for freebsd-hackers-outgoing; Fri, 30 Oct 1998 23:47:15 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA25251 for ; Fri, 30 Oct 1998 23:47:10 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.9.1/8.9.1/Spinner) with ESMTP id PAA18872; Sat, 31 Oct 1998 15:46:40 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199810310746.PAA18872@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: Mike Smith cc: Peter Jeremy , hackers@FreeBSD.ORG Subject: Re: sync writes with softupdates enabled In-reply-to: Your message of "Thu, 29 Oct 1998 21:29:10 PST." <199810300529.VAA00927@dingo.cdrom.com> Date: Sat, 31 Oct 1998 15:46:39 +0800 From: Peter Wemm Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mike Smith wrote: > > I've just installed 3.0-RELEASE on the machine destined to be our new > > news server. Whilst testing it with soft updates enabled, I'm seeing > > a lot of sync writes onto /usr: > > > > /dev/wd0s1f on /usr (local, soft-updates, writes: sync 32910 async 4955) > > > > With /usr mounted asynchronously rather than soft updates enabled, > > I also saw lots of synchronous writes. > > > > The writes are definitely a result of innd - nothing else much is > > running and pausing innd makes the I/O stop. I've looked at a > > ktrace of innd and can't see anything that would obviously cause it > > to do sync writes (no fsync() or open(O_SYNC) calls). > > > > It's inn-1.7.2 as per the ports with the exception that MMAP is > > enabled for dbz. > > > > All I can think of is that the MMAP'd history file is causing the > > kernel to unnecessarily perform sync writes to try and keep the > > MMAP and VFS images in sync. > > That's almost certainly correct. Try running without mmap. It used to > be faster that way; maybe it is again? Hmm, from vm_object.c: void vm_object_page_clean(object, start, end, flags) pagerflags = (flags & (OBJPC_SYNC | OBJPC_INVAL)) ? VM_PAGER_PUT_SYNC : 0; pagerflags |= (flags & OBJPC_INVAL) ? VM_PAGER_PUT_INVAL : 0; VOP_FSYNC(vp, NULL, (pagerflags & VM_PAGER_PUT_SYNC)?MNT_WAIT:0, curproc); vm_object.h: #define OBJPC_SYNC 0x1 /* sync I/O */ #define OBJPC_INVAL 0x2 /* invalidate */ Yet, we have: vfs_subr.c: vm_object_page_clean(vp->v_object, 0, 0, TRUE); vfs_syscalls.c: vm_object_page_clean(vp->v_object, 0, 0, FALSE); param.h:#define TRUE 1 param.h:#define FALSE 0 The sync_fsync() writes are calling vfs_msync() with MNT_NOWAIT, but vfs_msync() is turning dirty mmap pages into sync writes. This behavior is needed prior to unmount (obviously) but doesn't seem useful for the periodic sync. Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message