From nobody@FreeBSD.org  Thu Feb 21 17:15:09 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 2E51537B404
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Feb 2002 17:15:08 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g1M1F8d90824;
	Thu, 21 Feb 2002 17:15:08 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200202220115.g1M1F8d90824@freefall.freebsd.org>
Date: Thu, 21 Feb 2002 17:15:08 -0800 (PST)
From: Andrew Mobbs <andrewm@chiark.greenend.org.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: msync performance on large files
X-Send-Pr-Version: www-1.0

>Number:         35195
>Category:       kern
>Synopsis:       msync performance on large files
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 21 17:20:01 PST 2002
>Closed-Date:    Mon Aug 26 14:54:02 PDT 2002
>Last-Modified:  Mon Aug 26 14:54:02 PDT 2002
>Originator:     Andrew Mobbs
>Release:        4.5-RC
>Organization:
>Environment:
FreeBSD kadath.relativity.greenend.org.uk 4.5-RC FreeBSD 4.5-RC #1: Sat Jan 12 13:49:05 GMT 2002     root@kadath.relativity.greenend.org.uk:/usr/obj/usr/src/sys/011218kadath  i386

>Description:
I wrote a test application that reflects the I/O load of an application I have in mind. This mmaps a 1GB file, and does 100,000 operations to it, then msyncs. Each operation consists of a read/modify/write then a write to a random location of the file.

The test platform is an Athlon 1.3GHz, 512MB RAM, with the test file on a single ATA-66 hard disk. There is little else using the system during the test, and nothing using the disk the test file is on.

The application takes 529 seconds to complete its workload, with the disk at 100% busy, and I/O at 2.5 - 3MB.s. The application then calls msync, this takes a total of 2593 seconds to complete, with I/O at about .6 MB/s. During the initial phase, the RSS of the application grows to approximatly 300MB, during the final phase, the RSS slowly shrinks.

If I'm reading spec_fsync in spec_vnops.c correctly, on msync the kernel is walking the dirty buffer list by age, thus writing out about 300MB of blocks in a totally random order, in 8kB chunks.


>How-To-Repeat:
On a quiet system with plenty of spare memory, on a filesystem with at least 1GB free run:
http://www.chiark.greenend.org.uk/~andrewm/mmt.c

The test will take slightly less than 1 hour to complete on an equivalent system to the above mentioned.
>Fix:
spec_vnops.c:spec_fsync() could benefit from a scatter-gather algorithm to collate blocks and perform I/O in an efficient order. This could provide a significant speed-up to this test.

>Release-Note:
>Audit-Trail:

From: Andrew Mobbs <andrewm@kadath.relativity.greenend.org.uk>
To: freebsd-gnats-submit@FreeBSD.org, andrewm@chiark.greenend.org.uk
Cc:  
Subject: Re: kern/35195: msync performance on large files
Date: Mon, 26 Aug 2002 22:27:17 +0100 (BST)

 Fixed by vm.msync_flush_flags sysctl
 Patch MFC'd in June.
 Please close.
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Mon Aug 26 14:53:17 PDT 2002 
State-Changed-Why:  
Closed at submitters request as problem was fixed by MFC in June. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35195 
>Unformatted:
