From owner-freebsd-stable@FreeBSD.ORG Fri Apr 18 00:13:32 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9F57737B401; Fri, 18 Apr 2003 00:13:32 -0700 (PDT) Received: from HAL9000.homeunix.com (12-233-57-131.client.attbi.com [12.233.57.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB73D43FB1; Fri, 18 Apr 2003 00:13:31 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.5) with ESMTP id h3I7DU9E009228; Fri, 18 Apr 2003 00:13:30 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.5/Submit) id h3I7DTni009227; Fri, 18 Apr 2003 00:13:29 -0700 (PDT) (envelope-from das@FreeBSD.org) Date: Fri, 18 Apr 2003 00:13:29 -0700 From: David Schultz To: Marko Zec Message-ID: <20030418071329.GA9125@HAL9000.homeunix.com> Mail-Followup-To: Marko Zec , freebsd-fs@FreeBSD.org, freebsd-stable@FreeBSD.org References: <3E976EBD.C3E66EF8@tel.fer.hr> <20030414101935.GB18110@HAL9000.homeunix.com> <3E9C5975.43755858@tel.fer.hr> <20030416101136.GA868@HAL9000.homeunix.com> <3E9E93D8.EB16ED42@tel.fer.hr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3E9E93D8.EB16ED42@tel.fer.hr> cc: freebsd-fs@FreeBSD.org cc: freebsd-stable@FreeBSD.org Subject: Re: PATCH: Forcible delaying of UFS (soft)updates X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2003 07:13:32 -0000 On Thu, Apr 17, 2003, Marko Zec wrote: > David Schultz wrote: > > > On Tue, Apr 15, 2003, Marko Zec wrote: > > > > > > > - The fiddling with rushjob seems rather arbitrary. You can probably > > > > just let the existing code increment it as necessary and force a sync > > > > if the value gets too high. > > > > > > If rushjob is would not be used for forcing prompt synching, the original code > > > could not guarantee the sync to occur immediately. Instead, the synching could > > > be further delayed for up to 30 seconds, which is not desirable if our major > > > design goal is to do as much disk I/O as possible in a small time interval and > > > leave the disk idle otherwise. > > > > I was referring to all the places where rushjob is set to or > > incremented by syncer_maxdelay. AFAIK, it should never be that > > large. > > Hmm... Why? :) > > > I don't think you want to overload a low memory handling > > mechanism with the task of syncing the disk. > > As far as I can see the rushjob variable is used only at one place in > kern/vfs_subr.c to notify softupdates synching scheduler to start synching earlier > than the normal timers would expire. I just reused the same mechanism to urge > synching of dirty buffers when the extra delay timer expires, or when outstanding > disk I/O occurs, to coalesce disk updates with occasional disk spinups. When the system is low on memory or has reached a related limit, it tries to sync data to disk faster by slowly increasing the value of rushjob until the situation improves. If the syncer is able to keep up, it will process data faster and pull rushjob back down to zero. If rushjob gets too high (half the maximum sync delay, usually 15), the system resorts to other measures. Your code bumps rushjob up by the arbitrary value 32, which is rather large. Doing so is going to throw things out of whack. What you would probably want to do is leave rushjob alone. If it ever becomes nonzero, the syncer should wake up and start writing again. If you would like to write the data out more quickly whenever the disks start up so you can make them spin down again, look at softdep_request_cleanup() in -CURRENT. But really, even getting fsync() to do *remotely* the right thing (i.e. correct ordering but no guarantee of writing data to stable storage when in power save mode) is going to be *really*hard*. Warner has a much better suggestion.