Thread (8 messages) 8 messages, 5 authors, 2008-05-29

Re: [Bug 421482] Firefox 3 uses fsync excessively

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2008-05-26 07:05:06
Also in: linux-fsdevel

This:

On Sun, 25 May 2008 22:13:10 -0700 bugzilla-daemon@mozilla.org wrote:
quoted hunk
Do not reply to this email.  You can add comments to this bug at
https://bugzilla.mozilla.org/show_bug.cgi?id=421482




--- Comment #152 from Karl Tomlinson (:karlt) <mozbugz@karlt.net>  2008-05-25 22:12:23 PDT ---
Created an attachment (id=322475)
 --> (https://bugzilla.mozilla.org/attachment.cgi?id=322475)
fdatasync/sync_file_range test program

fdatasync/sync_file_range test program

This first creates a file of length 1 then does one fsync on the new file.
Then the file is continually modified without changing the length and synced
after each modification using one of three methods (somewhat randomly
selected): fsync/fdatasync/sync_file_range.

The I/O load for the test results below was produced using dd with a small
blocksize to limit the I/O some:

dd if=/dev/zero of=large bs=64 count=$((3*1024*1024*1024/64))

I used ltrace instead of strace as my strace didn't find sync_file_range (and
my glibc-2.5 libraries don't seem to have a sync_file_range function), so
sync_file_range appears below as "syscall(277".

rm -f datasync-test.tmp &&
ltrace -t -T -e trace=,fsync,fdatasync,syscall ./a.out

16:12:59 fsync(3) = 0                   <11.864858>
16:13:13 fdatasync(3) = 0               <14.706356>
16:13:30 fsync(3) = 0                   <12.832373>
16:13:45 syscall(277, 3, 0, 1, 7) = 0   <0.343116>
16:13:49 fdatasync(3) = 0               <8.231468>
16:14:01 syscall(277, 3, 0, 1, 7) = 0   <2.347144>
16:14:06 fsync(3) = 0                   <6.938656>
16:14:16 fdatasync(3) = 0               <8.359644>
16:14:27 fsync(3) = 0                   <5.928242>
16:14:35 syscall(277, 3, 0, 1, 7) = 0   <0.009531>
16:14:39 fdatasync(3) = 0               <7.356126>
16:14:50 fsync(3) = 0                   <6.402128>
16:14:59 syscall(277, 3, 0, 1, 7) = 0   <0.802706>
16:15:03 syscall(277, 3, 0, 1, 7) = 0   <2.985404>
16:15:08 fsync(3) = 0                   <4.722020>
16:15:15 fdatasync(3) = 0               <6.532945>
16:15:24 fdatasync(3) = 0               <2.294488>
16:15:30 fsync(3) = 0                   <7.986250>
16:15:40 syscall(277, 3, 0, 1, 7) = 0   <1.409809>
16:15:45 fdatasync(3) = 0               <5.404190>

The results are consistent with fdatasync being implemented as fsync on ext3.

They show the potential for considerable savings from growing (and shrinking)
files in large hunks and using sync_file_range (which also should reduce the
impact on the rest of the filesystem).
is wrong, isn't it?

It's purportedly showing that fdatasync() on ext3 is syncing the whole
world in fsync()-fashion even with an application which does not grow
the file size.

But fdatasync() shouldn't do that.  Even if the inode is dirty from
atime or mtime updates, that shouldn't cause fdatasync() to run an
ext3 commit?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help