Re: mmap performance

From: Arjan van de Ven (
Date: Thu Apr 27 2000 - 04:11:00 EST

In article <> you wrote:

> --ZPt4rx8FFjLCG7dd
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: quoted-printable

> Please CC any replies to I can't cope with the traffic =
> of
> linux-kernel. Thanks.

> I'm writing a network server. Very simply put it reads requests from a sock=
> et
> and replies with the contents of some local file that the client requested.

> Currently I mmap the files and then feed it to the socket when select(2)
> says it is ready for writing. If another request comes in for the same file
> then file the file is already mmap'ed and it's just sent.

This would be a very good case for the "sendfile" system call. It lets the
kernel handle all this stuff, without the need for the kind of tricks you
described. [*]

   Arjan van de Ven

[*] I think sendfile() currently is blocking, but a first look at it
suggests that this is fixable with a five-line patch.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:12 EST