From: stewart@neuron.com
To: linux-kernel@vger.kernel.org
Subject: sync() broken for raw devices in 2.4.x??
Date: Mon, 1 Jan 2001 19:50:31 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.10.10101011925130.1859-100000@localhost> (raw)
I have a sync()/fdatasync() intensive application that is designed to work
on both raw files and raw partitions. Today I upgraded my kernel to the
new pre-release and found that my benchmark program would no longer finish
when handed a raw partition. I've written a small Java program (my app is
in Java) which demonstrates the bug. Make foo.dat a raw scsi partition to
re-produce. In my case it's "mknod foo.dat b 8 18".
// -----------------------------------------------------
import java.io.*;
public class sync {
public static void main(String args[]) throws Exception {
long ops = Long.parseLong(args[0]);
byte dat[] = new byte[Integer.parseInt(args[1])];
RandomAccessFile rf = new RandomAccessFile("foo.dat", "rw");
long time = System.currentTimeMillis();
long t2 = time;
for (int i=0; i<ops; i++) {
rf.write(dat);
rf.getFD().sync();
if (i%100 == 0) {
long tm = System.currentTimeMillis();
System.out.println("i="+i+" sync avg ms="+((tm-t2)/100));
t2 = tm;
}
}
time = System.currentTimeMillis()-time;
System.out.println("time = "+time+"ms");
System.out.println(((ops*1000)/time)+" ops/sec");
}
}
// -----------------------------------------------------
I've included 2.2.17 as a baseline for comparison w/ 2.4.0-prerelease.
Watch the avg sync times. The tests were run with the command-line:
java sync 10000 4096
2.2.17 on an ext2 file looks like this:
i=0 sync avg ms=0
i=100 sync avg ms=11
i=200 sync avg ms=13
...
i=9700 sync avg ms=21
i=9800 sync avg ms=21
i=9900 sync avg ms=21
time = 153510ms
65 ops/sec
2.4.0 on an ext2 file looks like this:
=0 sync avg ms=0
i=100 sync avg ms=13
i=200 sync avg ms=13
...
i=9700 sync avg ms=16
i=9800 sync avg ms=16
i=9900 sync avg ms=15
time = 140780ms
71 ops/sec
OK, that's better. My benchmarks confirm that under ext2, 2.4.0 is
generally superior, though I'm still getting some suspicious hangs.
I'll report back on that if I can reproduce it with a sample program.
2.2.17 with a raw partition:
i=0 sync avg ms=0
i=100 sync avg ms=0
i=200 sync avg ms=0
...
i=9700 sync avg ms=0
i=9800 sync avg ms=1
i=9900 sync avg ms=1
time = 22825ms
438 ops/sec
2.4.0 with a raw partition:
i=0 sync avg ms=0
i=100 sync avg ms=0
i=200 sync avg ms=0
...
i=9700 sync avg ms=39
i=9800 sync avg ms=39
i=9900 sync avg ms=40
time = 202406ms
49 ops/sec
OK, 2.4.0 gets progressively (visibly) slower as the test goes on. Even
under 2.2.17 the test would cycle between 0-6ms over several thousand
iterations. This could be sped up/slowed by changing the data volume.
2.4.0, however, never recovers and sync() times will become infinitely
large. This explains why my benchmarks never complete.
The system in this case is a dual p2-450 512MB ram and SCSI disks. I have
not tested this with IDE drives under 2.4.0 nor have I performed these
tests under other 2.4.x test kernels.
Stewart
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next reply other threads:[~2001-01-02 1:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-02 0:50 stewart [this message]
2001-01-02 1:35 ` Andi Kleen
2001-01-02 15:26 ` stewart
2001-01-02 17:57 ` stewart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.10.10101011925130.1859-100000@localhost \
--to=stewart@neuron.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®