public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Al Boldi" <a1426z@gawab.com>
To: "'Jens Axboe'" <axboe@suse.de>,
	"'Steven Pratt'" <slpratt@austin.ibm.com>
Cc: "'Andrew Morton'" <akpm@osdl.org>, <torvalds@osdl.org>,
	<grant_lkml@dodo.com.au>, <linux@rainbow-software.org>,
	<andre@tomt.net>, <linux-kernel@vger.kernel.org>
Subject: RE: [git patches] IDE update
Date: Sun, 10 Jul 2005 00:39:17 +0300	[thread overview]
Message-ID: <200507092139.AAA03256@raad.intranet> (raw)
In-Reply-To: <20050709054053.GX7050@suse.de>

[-- Attachment #1: Type: text/plain, Size: 6142 bytes --]

Jens Axboe <axboe@suse.de> wrote:{
> >>   
> >>>Some more investigation - it appears to be broken read-ahead, actually.
> >>>
> >>>--- mm/readahead.c~	2005-07-08 11:16:14.000000000 +0200
> >>>+++ mm/readahead.c	2005-07-08 11:17:49.000000000 +0200
> >>>@@ -351,7 +351,9 @@
> >>> 		ra->cache_hit += nr_to_read;
> >>> 		if (ra->cache_hit >= VM_MAX_CACHE_HIT) {
> >>> 			ra_off(ra);
> >>>+#if 0
> >>> 			ra->flags |= RA_FLAG_INCACHE;
> >>>+#endif
> >>> 			return 0;
> >>> 		}
> >>> 	} else {
> >>
> >> >Just use the test app I posted, it shows the problem just fine. If I 
> >use a regular file, behaviour is identical as expected (ie equally 
> >broken :-).
}

Modified test app shows comparison w/ and w/o O_DIRECT.

Your comments please!

2.4.31# (hdparm -f /dev/hda;free;time /tmp/readisk /dev/hda 1 )

/dev/hda:
             total       used       free     shared    buffers     cached
Mem:        256388      23728     232660          0       1944       4324
-/+ buffers/cache:      17460     238928
Swap:            0          0          0
Mem Throughput: 107 MiB/sec - 8388608-16 bs-blks
Mem Throughput: 121 MiB/sec - 4194304-32 bs-blks
Mem Throughput: 122 MiB/sec - 2097152-64 bs-blks
Mem Throughput: 122 MiB/sec - 1048576-128 bs-blks
Mem Throughput: 120 MiB/sec - 524288-256 bs-blks
Mem Throughput: 120 MiB/sec - 262144-512 bs-blks
Mem Throughput: 131 MiB/sec - 131072-1024 bs-blks
Mem Throughput: 336 MiB/sec - 65536-2048 bs-blks
Mem Throughput: 476 MiB/sec - 32768-4096 bs-blks
Mem Throughput: 432 MiB/sec - 16384-8192 bs-blks
Mem Throughput: 824 MiB/sec - 8192-16384 bs-blks	<--- 20% faster
Mem Throughput: 799 MiB/sec - 4096-32768 bs-blks
Mem Throughput: 494 MiB/sec - 2048-65536 bs-blks
Mem Throughput: 270 MiB/sec - 1024-131072 bs-blks
Mem Throughput: 146 MiB/sec - 512-262144 bs-blks
Mem Throughput: 76 MiB/sec - 256-524288 bs-blks
Disk Throughput: 39 MiB/sec
1.13user 12.35system 0:15.65elapsed 86%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (87major+2061minor)pagefaults 0swaps
=====================================================================

2.4.31# (hdparm -f /dev/hda;free;time /tmp/readisk /dev/hda 1 1 )
O_DIRECT

/dev/hda:
             total       used       free     shared    buffers     cached
Mem:        256388      23824     232564          0       2024       4324
-/+ buffers/cache:      17476     238912
Swap:            0          0          0
Mem Throughput: 36 MiB/sec - 8388608-16 bs-blks
Mem Throughput: 34 MiB/sec - 4194304-32 bs-blks
Mem Throughput: 34 MiB/sec - 2097152-64 bs-blks
Mem Throughput: 37 MiB/sec - 1048576-128 bs-blks
Mem Throughput: 29 MiB/sec - 524288-256 bs-blks		<--- small dip
Mem Throughput: 15 MiB/sec - 262144-512 bs-blks		<--- 333% slower
Mem Throughput: 42 MiB/sec - 131072-1024 bs-blks
Mem Throughput: 45 MiB/sec - 65536-2048 bs-blks
Mem Throughput: 40 MiB/sec - 32768-4096 bs-blks
Mem Throughput: 36 MiB/sec - 16384-8192 bs-blks
Mem Throughput: 33 MiB/sec - 8192-16384 bs-blks
Mem Throughput: 25 MiB/sec - 4096-32768 bs-blks
Mem Throughput: 16 MiB/sec - 2048-65536 bs-blks
Mem Throughput: 10 MiB/sec - 1024-131072 bs-blks
read infile: Invalid argument 512-262144 bs-blks	<--- too small?
read infile: Invalid argument 256-524288 bs-blks
Disk Throughput: 38 MiB/sec
0.27user 10.88system 1:12.95elapsed 15%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (99major+2062minor)pagefaults 0swaps
=====================================================================

2.6.12# (hdparm -f /dev/hda;free;time /tmp/readisk /dev/hda 1 )

/dev/hda:
             total       used       free     shared    buffers     cached
Mem:        255228      15668     239560          0       5060       4252
-/+ buffers/cache:       6356     248872
Swap:            0          0          0
Mem Throughput: 97 MiB/sec - 8388608-16 bs-blks
Mem Throughput: 120 MiB/sec - 4194304-32 bs-blks
Mem Throughput: 120 MiB/sec - 2097152-64 bs-blks
Mem Throughput: 120 MiB/sec - 1048576-128 bs-blks
Mem Throughput: 121 MiB/sec - 524288-256 bs-blks
Mem Throughput: 120 MiB/sec - 262144-512 bs-blks
Mem Throughput: 129 MiB/sec - 131072-1024 bs-blks
Mem Throughput: 237 MiB/sec - 65536-2048 bs-blks
Mem Throughput: 451 MiB/sec - 32768-4096 bs-blks
Mem Throughput: 418 MiB/sec - 16384-8192 bs-blks
Mem Throughput: 636 MiB/sec - 8192-16384 bs-blks
Mem Throughput: 672 MiB/sec - 4096-32768 bs-blks	<--- 20% slower
Mem Throughput: 399 MiB/sec - 2048-65536 bs-blks
Mem Throughput: 217 MiB/sec - 1024-131072 bs-blks
Mem Throughput: 115 MiB/sec - 512-262144 bs-blks
Mem Throughput: 59 MiB/sec - 256-524288 bs-blks
Disk Throughput: 26 MiB/sec
0.93user 13.79system 0:18.59elapsed 79%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2150minor)pagefaults 0swaps
=====================================================================

2.6.12# (hdparm -f /dev/hda;free;time /tmp/readisk /dev/hda 1 1)
O_DIRECT

/dev/hda:
             total       used       free     shared    buffers     cached
Mem:        255228      15668     239560          0       5060       4252
-/+ buffers/cache:       6356     248872
Swap:            0          0          0
Mem Throughput: 33 MiB/sec - 8388608-16 bs-blks
Mem Throughput: 30 MiB/sec - 4194304-32 bs-blks
Mem Throughput: 34 MiB/sec - 2097152-64 bs-blks
Mem Throughput: 39 MiB/sec - 1048576-128 bs-blks
Mem Throughput: 30 MiB/sec - 524288-256 bs-blks		<--- small dip
Mem Throughput: 49 MiB/sec - 262144-512 bs-blks		<--- 333% faster
Mem Throughput: 49 MiB/sec - 131072-1024 bs-blks
Mem Throughput: 44 MiB/sec - 65536-2048 bs-blks
Mem Throughput: 42 MiB/sec - 32768-4096 bs-blks
Mem Throughput: 40 MiB/sec - 16384-8192 bs-blks
Mem Throughput: 29 MiB/sec - 8192-16384 bs-blks
Mem Throughput: 22 MiB/sec - 4096-32768 bs-blks
Mem Throughput: 14 MiB/sec - 2048-65536 bs-blks
Mem Throughput: 8 MiB/sec - 1024-131072 bs-blks
Mem Throughput: 4 MiB/sec - 512-262144 bs-blks
read infile: Invalid argument 256-524288 bs-blks	<--- too small?
Disk Throughput: 34 MiB/sec
0.69user 32.09system 1:39.15elapsed 33%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2164minor)pagefaults 0swaps
=====================================================================

[-- Attachment #2: rd128.c --]
[-- Type: application/octet-stream, Size: 1702 bytes --]

//#include <stdio.h>
#include <unistd.h>
#define __USE_GNU
#include <fcntl.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <linux/fs.h>

#define BS		(8192*1024)
#define BLOCKS		(128*1024/8192)
#define ALIGN(buf)	(char *) (((unsigned long) (buf) + 4095) & ~(4095))

void print_time(struct timeval *s, int memory)
{
	unsigned long ms, mb;
	struct timeval e;
	mb = BS * BLOCKS / 1024;
	gettimeofday(&e, NULL);
	ms = (e.tv_sec - s->tv_sec) * 1000 + (e.tv_usec - s->tv_usec) / 1000;

	if (memory)
		printf("Mem Throughput: %lu MiB/sec - %lu-%lu bs-blks\n", mb / ms, BS/memory, BLOCKS*memory);
	else
		printf("Disk Throughput: %lu MiB/sec\n", mb / ms);
}

void read_stuff(int fd, char *buffer, int memory)
{
	struct timeval s;
	int i, ret;

	int j=1; if (memory)\r j=memory;

	gettimeofday(&s, NULL);

	for (i = 0; i < (BLOCKS*j); i++) {
		if (memory)
			lseek(fd, 0, SEEK_SET);
		ret = read(fd, buffer, BS/j);

		if (!ret)
			break;
		else if (ret < 0) {
			perror("read infile");
//			break;
			return;
		}
	}
	print_time(&s, memory);
}

int main(int argc, char *argv[])
{
	char *buffer;
	int i, fd, seek;
	if (argc < 2) {
		printf("%s: <device>\n", argv[0]);
		return 1;
	}

	if (argc > 2)
		seek = 1;
	else
		seek = 0;

	if (argc > 3)
		fd = open(argv[1], O_RDONLY | O_DIRECT);
	else
		fd = open(argv[1], O_RDONLY );

	if (argc > 4)
		seek = 0;

	if (fd == -1) {
		perror("open");
		return 2;
	}
	ioctl(fd, BLKFLSBUF, 0);

	buffer = ALIGN(malloc(BS + 4095));

	if (seek) {
	    for (i = 0; i < 16 ; i++) {
		read_stuff(fd, buffer, (2<<i)/2);
	}}
	read_stuff(fd, buffer, 0);
	return 0;
}

  reply	other threads:[~2005-07-09 21:41 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-03 16:52 [git patches] IDE update Bartlomiej Zolnierkiewicz
2005-07-04 12:01 ` Al Boldi
2005-07-04 12:30   ` Bartlomiej Zolnierkiewicz
2005-07-04 15:30     ` Al Boldi
2005-07-04 15:41       ` Bartlomiej Zolnierkiewicz
2005-07-04 17:06         ` Al Boldi
2005-07-04 17:38           ` Ondrej Zary
2005-07-04 19:51             ` Bartlomiej Zolnierkiewicz
2005-07-04 20:32               ` Al Boldi
2005-07-04 20:47                 ` Bartlomiej Zolnierkiewicz
2005-07-04 23:25                 ` André Tomt
2005-07-05  3:43                   ` IOWAIT block layer problem Al Boldi
2005-07-05 10:01                   ` [git patches] IDE update Ondrej Zary
2005-07-05 10:14                     ` Jens Axboe
2005-07-05 10:19                       ` Ondrej Zary
2005-07-05 10:42                         ` Jens Axboe
2005-07-05 12:35                           ` Ondrej Zary
2005-07-05 12:51                             ` Jens Axboe
2005-07-05 13:02                               ` Ondrej Zary
2005-07-05 13:11                                 ` Jens Axboe
2005-07-05 15:51                                   ` Ondrej Zary
2005-07-05 14:21                                     ` Jens Axboe
2005-07-05 15:00                                       ` Ondrej Zary
2005-07-05 19:18                                         ` Jens Axboe
2005-07-05 19:25                                         ` Jens Axboe
2005-07-05 21:36                                           ` Ondrej Zary
2005-07-05 17:27                                       ` Linus Torvalds
2005-07-05 19:14                                         ` Jens Axboe
2005-07-05 21:39                                           ` Ondrej Zary
2005-07-11 14:21                                           ` Alan Cox
2005-07-06  0:35                                       ` Grant Coady
2005-07-06  0:51                                         ` Linus Torvalds
2005-07-06  3:26                                           ` Al Boldi
2005-07-06  4:56                                           ` Grant Coady
2005-07-06  5:22                                             ` Linus Torvalds
2005-07-08  8:48                                               ` Jens Axboe
2005-07-08  9:24                                                 ` Jens Axboe
2005-07-08  9:34                                                   ` Andrew Morton
2005-07-08  9:53                                                     ` Jens Axboe
2005-07-08 22:25                                                       ` Steven Pratt
2005-07-09  5:40                                                         ` Jens Axboe
2005-07-09 21:39                                                           ` Al Boldi [this message]
2005-07-08 10:20                                                 ` Ingo Molnar
2005-07-08 11:45                                                   ` Jens Axboe
2005-07-07 22:32                                         ` Mark Lord
2005-07-08  0:06                                           ` Grant Coady
2005-07-08 11:37                                             ` Erik Slagter
2005-07-06 20:56                         ` Bill Davidsen
2005-07-07 13:47                           ` Ondrej Zary
2005-07-07 13:48                           ` Bartlomiej Zolnierkiewicz
2005-07-07 19:34                             ` Bill Davidsen
2005-07-05  2:47 ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2005-08-18 21:37 [git patches] ide update Bartlomiej Zolnierkiewicz
2005-08-18 22:15 ` Linus Torvalds
2005-08-18 22:19   ` Nish Aravamudan
2005-08-19  0:44   ` Mark Lord
2005-08-18 23:08 ` Alan Cox
2005-08-19  9:02   ` Bartlomiej Zolnierkiewicz
2005-08-19 18:06     ` Alan Cox
2005-08-19 23:51       ` Bartlomiej Zolnierkiewicz
2005-08-19 23:52         ` Bartlomiej Zolnierkiewicz
2005-11-10  1:00 Bartlomiej Zolnierkiewicz
2005-11-18 23:21 Bartlomiej Zolnierkiewicz
2005-11-19 23:46 Bartlomiej Zolnierkiewicz
2005-12-15  2:03 Bartlomiej Zolnierkiewicz
2007-05-09 22:46 [git patches] IDE update Bartlomiej Zolnierkiewicz
2007-05-09 22:46 ` Jeff Garzik
2007-05-09 23:20   ` David Miller
2007-05-09 23:23   ` Bartlomiej Zolnierkiewicz
2007-05-09 23:18     ` Jeff Garzik
2007-05-09 22:47 ` Jeff Garzik
2007-05-09 22:59   ` Andrew Morton
2007-05-09 23:15     ` Jeff Garzik
2007-07-09 21:46 Bartlomiej Zolnierkiewicz

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=200507092139.AAA03256@raad.intranet \
    --to=a1426z@gawab.com \
    --cc=akpm@osdl.org \
    --cc=andre@tomt.net \
    --cc=axboe@suse.de \
    --cc=grant_lkml@dodo.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rainbow-software.org \
    --cc=slpratt@austin.ibm.com \
    --cc=torvalds@osdl.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