From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] TCP Zero Copy for mmapped files
Date: Fri, 3 Jan 2003 02:41:39 +0000 (UTC) [thread overview]
Message-ID: <av2t93$14v$1@penguin.transmeta.com> (raw)
In-Reply-To: 1041555419.24901.86.camel@irongate.swansea.linux.org.uk
In article <1041555419.24901.86.camel@irongate.swansea.linux.org.uk>,
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>On Thu, 2003-01-02 at 23:16, David S. Miller wrote:
>>
>> With sendfile() all of this goes straight to the page cache directly
>> without a VMA lookup.
>
>With a nasty unpleasant splat the moment you do modification on the
>content at all. For static objects sendfile is certainly superior,
Oh, the "unpleasant splat" happens with the mmap approach too, there's
no avoiding it. It can happen with a regular "read()" loop too (if the
read happens at the wrong time).
Both mmap and sendfile have the issue that the "splat" can happen every
time, while a read() into a private area means that the splat can only
happen the first time the web server caches the content. But the read
into a private area is also obviously the worst one from a performance
standpoint.
There are two ways to avoid the splat:
- lock the file some way before reading/writing to it.
- do all updates to a temp-file, and move the temp-file to the new location.
Those two approaches will fix the "splat" problem _regardless_ of what
IO mechanism you use. With that in mind, sendfile() is clearly the one
that performs best by far, so..
Linus
next prev parent reply other threads:[~2003-01-03 2:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-30 1:09 [PATCH] TCP Zero Copy for mmapped files Thomas Ogrisegg
2002-12-30 1:29 ` Larry McVoy
2003-01-02 6:37 ` David S. Miller
2003-01-02 22:12 ` Thomas Ogrisegg
2003-01-02 22:28 ` Larry McVoy
2003-01-02 23:20 ` Alan Cox
2003-01-02 23:16 ` David S. Miller
2003-01-03 0:56 ` Alan Cox
2003-01-03 2:40 ` David S. Miller
2003-01-03 2:41 ` Linus Torvalds [this message]
2003-01-02 23:13 ` David S. Miller
2003-01-03 0:45 ` Thomas Ogrisegg
2003-01-03 1:01 ` Larry McVoy
2003-01-03 1:59 ` Alan Cox
2003-01-06 14:36 ` Gianni Tedesco
2003-01-06 23:29 ` David S. Miller
2003-01-03 1:56 ` Alan Cox
2003-01-03 1:27 ` Larry McVoy
2003-01-03 2:42 ` David S. Miller
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='av2t93$14v$1@penguin.transmeta.com' \
--to=torvalds@transmeta.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