From: Troy Benjegerdes <hozer@hozed.org>
To: Piet Delaney <piet@bluelane.com>
Cc: Linus Torvalds <torvalds@osdl.org>, Jens Axboe <axboe@suse.de>,
"David S. Miller" <davem@davemloft.net>,
diegocg@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: Linux 2.6.17-rc2
Date: Fri, 21 Apr 2006 23:52:22 -0500 [thread overview]
Message-ID: <20060422045222.GP15855@narn.hozed.org> (raw)
In-Reply-To: <1145576344.25127.120.camel@piet2.bluelane.com>
<snip>
> > Basically, if you want the highest possible performance, you do not want
> > to do TLB invalidates. And if you _don't_ want the highest possible
> > performance, you should just use regular write(), which is actually good
> > enough for most uses, and is portable and easy.
>
> We use a zero copy, and also don't mess with the TLB. In our application
> 99.99% of the data is looked at but not modified (we are looking through
> TCP streams for a security exploitations).
>
> >
> > The thing is, the cost of marking things COW is not just the cost of the
> > initial page table invalidate: it's also the cost of the fault eventually
> > when you _do_ write to the page, even if at that point you decide that the
> > page is no longer shared, and the fault can just mark the page writable
> > again.
>
> Right, it's difficult for the kernel code to change the involved PTE's
> when it's done with a page. Then flushing the TLB's of involved CPU's
> adds to the problem.
>
> >
> > That cost is _bigger_ than the cost of just copying the page in the first
> > place.
> >
> > The COW approach does generate some really nice benchmark numbers, because
> > the way you benchmark this thing is that you never actually write to the
> > user page in the first place, so you end up having a nice benchmark loop
> > that has to do the TLB invalidate just the _first_ time, and never has to
> > do any work ever again later on.
> >
> > But you do have to realize that that is _purely_ a benchmark load. It has
> > absolutely _zero_ relevance to any real life. Zero. Nada. None. In real
> > life, COW-faulting overhead is expensive. In real life, TLB invalidates
> > (with a threaded program, and all users of this had better be threaded, or
> > they are leaving more performance on the floor) are expensive.
>
> Yea, your right, the multi-threading it a real problem,
> you would have to send a interrupt with information about which part
> of the TLB needs to be invalidated to each CPU.
>
> >
> > I claim that Mach people (and apparently FreeBSD) are incompetent idiots.
> > Playing games with VM is bad. memory copies are _also_ bad, but quite
> > frankly, memory copies often have _less_ downside than VM games, and
> > bigger caches will only continue to drive that point home.
>
> Yep, both of the zero copy implementations that I've worked on have
> used non-VM techniques to synchronize socket buffer state between the
> kernel and user space.
Do any of these zero-copy implementations allow you to maintain the old
fashioned read/write semantics? I'm quite sure I can find a real-world
computational chemistry application that wants plain old read/write
for network and filesystem access (and network filesystem access), that
is going to hand you a write() of 256M that is never going to fit into
any CPU cache, and you will always be better off playing COW games
rather than saturating the memory bus with memory copies.. particularly
because the application already saturated the memory bus of the system
doing computations on 16GB of data.
I would like to see some real numbers of *when*, not if a COW scheme
actually starts to be worth the page table flushing. This is a
trade-off, not some absolute 'COW is always bad'.
Lets also not forget that sometimes what an application cares about is
latency, not absolute performance.. so taking a *possible*, but not
certain future hit on TLB invalidates and reloads can be a win if you
get back to executing user code sooner and don't have to synchronize
with the kernel to find out you can use a page again.
next prev parent reply other threads:[~2006-04-22 19:32 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-19 3:27 Linus Torvalds
2006-04-19 7:30 ` [patch, 2.6.17-rc2] dm: fix typo Ingo Molnar
2006-04-19 7:33 ` Ingo Molnar
2006-04-19 18:00 ` Linux 2.6.17-rc2 Diego Calleja
2006-04-19 18:04 ` Hua Zhong
2006-04-19 19:40 ` splice and tee [was Linux 2.6.17-rc2] Jonathan Corbet
2006-04-19 18:44 ` Linux 2.6.17-rc2 Linus Torvalds
2006-04-19 19:20 ` Grzegorz Kulewski
2006-04-19 20:09 ` Linus Torvalds
2006-04-19 21:23 ` Trond Myklebust
2006-04-19 21:49 ` Linus Torvalds
2006-04-19 22:19 ` Peter Naulls
2006-04-20 13:21 ` Diego Calleja
2006-04-20 14:50 ` Jens Axboe
2006-04-20 15:32 ` Linus Torvalds
2006-04-20 19:19 ` Jens Axboe
2006-04-20 18:40 ` Linh Dang
2006-04-20 19:49 ` Jens Axboe
2006-04-20 19:57 ` Linh Dang
2006-04-20 20:02 ` Nick Piggin
2006-04-21 7:53 ` Jens Axboe
2006-04-20 20:08 ` Jens Axboe
2006-04-20 19:26 ` David S. Miller
2006-04-20 19:34 ` Jens Axboe
2006-04-20 19:39 ` David S. Miller
2006-04-20 19:44 ` Jens Axboe
2006-04-20 19:54 ` Nick Piggin
2006-04-20 21:37 ` Piet Delaney
2006-04-20 22:20 ` Linus Torvalds
2006-04-20 23:39 ` Piet Delaney
2006-04-21 0:09 ` Linus Torvalds
2006-04-20 23:26 ` David Lang
2006-04-21 0:49 ` David S. Miller
2006-04-22 4:52 ` Troy Benjegerdes [this message]
2006-04-21 0:41 ` David S. Miller
2006-04-21 17:58 ` Linus Torvalds
2006-04-21 18:15 ` Steven Rostedt
2006-04-21 18:42 ` Steven Rostedt
2006-04-21 0:20 ` David S. Miller
2006-04-21 2:05 ` Andi Kleen
2006-04-21 6:47 ` Piet Delaney
2006-04-20 16:24 ` Ingo Oeser
2006-04-20 19:52 ` splice(), vmsplice() niftiness [was: Re: Linux 2.6.17-rc2] bjd
2006-04-21 10:21 ` Linux 2.6.17-rc2 Alistair John Strachan
2006-04-21 16:40 ` Linus Torvalds
2006-04-21 17:21 ` Stephen Rothwell
2006-04-21 22:02 ` Andi Kleen
2006-04-22 0:53 ` Alistair John Strachan
2006-04-22 1:07 ` Andi Kleen
2006-04-22 13:21 ` Alistair John Strachan
2006-04-21 11:01 ` Linux 2.6.17-rc2 - notifier chain problem? Herbert Poetzl
2006-04-21 21:31 ` Chandra Seetharaman
2006-04-22 0:58 ` Herbert Poetzl
2006-04-24 21:26 ` Chandra Seetharaman
2006-04-24 22:03 ` Andrew Morton
2006-04-24 23:01 ` Chandra Seetharaman
2006-04-24 23:28 ` Andrew Morton
2006-04-25 0:19 ` Chandra Seetharaman
2006-04-26 15:49 ` Alan Stern
2006-04-26 18:18 ` Chandra Seetharaman
2006-04-26 18:43 ` Andrew Morton
2006-04-26 19:29 ` Ashok Raj
2006-04-26 20:21 ` Chandra Seetharaman
2006-04-26 20:26 ` Ashok Raj
2006-04-28 23:12 ` Chandra Seetharaman
2006-04-28 23:23 ` Andrew Morton
2006-04-28 23:33 ` Linus Torvalds
2006-04-28 23:48 ` Chandra Seetharaman
2006-04-28 23:43 ` Chandra Seetharaman
2006-04-29 15:30 ` Alan Stern
2006-04-22 6:40 ` Keith Owens
[not found] <63bym-4wt-3@gated-at.bofh.it>
[not found] ` <64eE4-1gP-15@gated-at.bofh.it>
[not found] ` <64eX5-1RE-13@gated-at.bofh.it>
[not found] ` <64wre-2cg-35@gated-at.bofh.it>
2006-04-24 4:42 ` Linux 2.6.17-rc2 Robert Hancock
2006-04-24 13:08 ` Alistair John Strachan
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=20060422045222.GP15855@narn.hozed.org \
--to=hozer@hozed.org \
--cc=axboe@suse.de \
--cc=davem@davemloft.net \
--cc=diegocg@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=piet@bluelane.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
Powered by JetHome