Re: mmap() is slower than read() on SCSI/IDE on 2.0 and 2.1

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Mon, 14 Dec 1998 23:35:08 +0100 (MET)


David S. Miller wrote:
> Date: Mon, 14 Dec 1998 05:43:21 -0800
> From: "Jay Nordwick" <nordwick@scam.XCF.Berkeley.EDU>

> You don't know how much to prefetch with read, do you?
>
> You never know _exactly_, but you know quite a bit.
>
> You know exactly at a read() call:
>
> 1) Where in the file.
> 2) How much the user wants in this request.
>
> For page faults you know exactly where but your "how much" is constant
> per request, that is PAGE_SIZE. This is the core problem.

I'd say that most apps use a fixed "buffer size". "cat" or "dd" use
0.5 to 8k buffers. That's constant buffer.

I thought that File readahead works by doubling the read-ahead size
every time the previous read-ahead worked.

To do this with paging, you need to prefetch pages, but not map them
into the userspace yet. When the page DOES get accessed, you get the
chance to quickly do the mapping, but at the same time you get the
same hints as with "read": the prefetch did its work -> Maybe increase
the prefetch size.....

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*   Never blow in a cat's ear because if you do, usually after three or  *
*   four times, they will bite your lips!  And they don't let go for at  *
*   least a minute. -- Lisa Coburn, age 9

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/