From: Andy Lutomirski <luto@myrealbox.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Tom Felker <tcfelker@mtco.com>,
Matthias Schniedermeyer <ms@citd.de>,
linux-kernel@vger.kernel.org
Subject: Re: why swap at all?
Date: Thu, 27 May 2004 04:39:05 -0700 [thread overview]
Message-ID: <40B5D359.2030702@myrealbox.com> (raw)
In-Reply-To: <fa.bqpvcrs.u648jq@ifi.uio.no>
Nick Piggin wrote:
> Tom Felker wrote:
>
>> On Wednesday 26 May 2004 7:37 am, Matthias Schniedermeyer wrote:
>>
>>
>>> program to kernel: "i read ONCE though this file caching not useful".
>>
>>
>>
>> Very true. The system is based on the assumption that just-used pages
>> are more useful that older pages, and it slows when this isn't true.
>> We need ways to tell the kernel whether the assumption holds.
>>
>
> A streaming flag is great, but we usually do OK without it. There
> is a "used once" heuristic that often gets it right as far as I
> know. Basically, new pages that are only used once put almost zero
> pressure on the rest of the memory.
(Disclaimer: I don't know all that much about the current scheme.)
First, I don't believe this works. A couple weeks ago I did
# cp -a <~100GB> <different physical disk>
and my system was nearly unusable for a few hours. This is Athlon 64
3200+, 512MB RAM, DMA on on both drives, iowait time around 90%. So this
was an io/pagecache problem.
The benchmark involved was ls. It took several seconds. If I ran it again
in 5 seconds or so, it was fine. Much longer and it would take several
seconds again. Sounds like pages getting evicted in LRU order.
I have this problem not only on every linux kernel I've ever tried (on
different computers) but on other OS's as well. It's not an easy one to solve.
For kicks, I checked out vmstat 1 (I don't have a copy right of the
output). It looked like cp -a dirtied pages as long as it could get them,
and they got written out as quickly as they could. And, for whatever
reason, the writes lag behind the reads by an amount comparable to the size
of my physical memory.
It seems like some kind of limiting/balancing of what gets to use the cache
is needed. I bet that most workloads that touch data much larger than RAM
don't benefit that much from caching it all. (Yes, that kernel-tree-grep
from cache is nice, but having glibc in cache is also nice.)
Should there be something like a (small) limit to how many dirty,
non-mmaped pages a task can have? I have no objection to a program taking
longer to finish because the 100MB it writes need to mostly hit the platter
before it returns, since, in return, I get a usable system while it's
running and it's not taking any more CPU time.
Second (IMHO) a "used once" heuristic has a fundamental problem:
If there are more pages "used more than once" _in roughly sequential order_
than fit in memory, then trying to cache them all is absurd. That is, if
some program makes _multiple passes_ over that 100GB (mkisofs?), the system
should never try to cache it all. It would be better off taking a guess
(even a wild-ass-guess) of which 200MB to cache plus a few MB for
readahead, leaving pages from other programs in cache for more than a few
seconds, and probably getting better performance (i.e. those 200MB are at
least cached next time around).
Is any of this reasonable?
--Andy
next parent reply other threads:[~2004-05-27 11:39 UTC|newest]
Thread overview: 157+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.fegqf9v.kmidof@ifi.uio.no>
[not found] ` <fa.bqpvcrs.u648jq@ifi.uio.no>
2004-05-27 11:39 ` Andy Lutomirski [this message]
2004-05-28 21:37 ` why swap at all? Denis Vlasenko
2004-05-28 22:28 ` Bernd Eckenfels
2004-05-29 7:31 ` Denis Vlasenko
2004-05-29 8:40 ` MM patches (was Re: why swap at all?) Nick Piggin
2004-05-29 8:46 ` Nick Piggin
[not found] ` <200405292014.23559.matt@lpbproductions.com>
2004-05-30 3:31 ` Nick Piggin
2004-05-31 13:13 ` Tvrtko A. Uršulin
2004-05-31 13:33 ` Con Kolivas
2004-05-31 17:34 ` Andy Lutomirski
2004-05-31 10:49 ` why swap at all? jlnance
2004-06-01 11:57 ` Lenar Lõhmus
2004-06-01 12:27 ` Robin Rosenberg
2004-06-01 16:49 ` jlnance
2004-06-01 17:38 ` why swap at all? (what the user feels) Martin Olsson
2004-06-01 17:57 ` Valdis.Kletnieks
2004-06-01 18:01 ` David Schwartz
2004-06-01 19:01 ` Robin Rosenberg
2004-06-01 19:04 ` David Schwartz
2004-06-02 18:38 ` why swap at all? John Hendrikx
2004-06-01 12:21 ` David B. Stevens
[not found] <fa.amhil9e.o5kt1u@ifi.uio.no>
[not found] ` <fa.kfm8lru.1l2mdp4@ifi.uio.no>
2004-06-08 15:12 ` Ray Bryant
2004-06-08 15:15 ` Ray Bryant
2004-06-09 19:24 ` Bill Davidsen
2004-05-31 19:34 Michael Brennan
2004-05-31 20:29 ` John Bradford
2004-05-31 22:47 ` Nick Piggin
2004-05-31 23:30 ` Bernd Eckenfels
2004-06-01 18:36 ` FabF
2004-06-01 19:02 ` Valdis.Kletnieks
2004-06-01 19:53 ` FabF
2004-06-01 20:00 ` Valdis.Kletnieks
2004-06-01 20:14 ` FabF
2004-06-01 20:22 ` Valdis.Kletnieks
2004-06-01 21:15 ` FabF
2004-06-01 21:40 ` Valdis.Kletnieks
2004-06-03 13:54 ` Bill Davidsen
2004-06-04 0:01 ` Nick Piggin
2004-06-01 23:17 ` Bernd Eckenfels
2004-06-02 5:38 ` FabF
2004-06-02 11:42 ` Con Kolivas
2004-06-02 12:22 ` John Bradford
2004-06-02 12:22 ` Con Kolivas
2004-06-02 17:06 ` FabF
2004-06-03 14:14 ` Bill Davidsen
2004-06-04 7:23 ` Buddy Lumpkin
2004-06-04 17:08 ` Bill Davidsen
2004-06-15 14:55 ` Charles Shannon Hendrix
2004-06-04 9:11 ` Catalin BOIE
2004-06-04 17:24 ` Bill Davidsen
2004-06-06 14:39 ` Rik van Riel
2004-06-02 17:59 ` Valdis.Kletnieks
2004-06-02 18:30 ` FabF
2004-06-02 23:54 ` Con Kolivas
2004-06-03 16:16 ` FabF
2004-06-03 23:56 ` Con Kolivas
2004-06-04 0:16 ` Con Kolivas
2004-06-03 14:18 ` Bill Davidsen
2004-06-03 14:27 ` Con Kolivas
2004-06-02 17:52 ` Valdis.Kletnieks
2004-06-02 3:50 ` Tim Connors
2004-06-02 17:45 ` Valdis.Kletnieks
2004-06-01 8:34 ` John Bradford
2004-06-01 8:32 ` William Lee Irwin III
2004-06-01 8:50 ` John Bradford
2004-06-01 8:54 ` William Lee Irwin III
2004-06-01 9:10 ` John Bradford
2004-06-08 1:18 ` Tim Connors
2004-06-08 5:29 ` Denis Vlasenko
2004-06-01 9:38 ` Buddy Lumpkin
2004-06-01 10:13 ` Tim Connors
2004-06-01 10:24 ` William Lee Irwin III
2004-06-01 11:19 ` Tim Connors
-- strict thread matches above, loose matches on Subject: below --
2004-05-27 12:31 Piszcz, Justin Michael
2004-05-27 12:41 ` William Lee Irwin III
2004-05-27 15:59 ` John Bradford
2004-05-27 16:16 ` William Lee Irwin III
2004-06-03 13:38 ` Bill Davidsen
2004-05-27 5:37 Nick Piggin
2004-05-27 17:27 ` Buddy Lumpkin
2004-05-26 12:34 Piszcz, Justin Michael
2004-05-26 12:24 Nick Piggin
2004-05-26 13:03 ` Buddy Lumpkin
2004-05-26 13:27 ` Helge Hafting
2004-05-26 11:57 Nick Piggin
2004-05-26 12:19 ` Buddy Lumpkin
2004-05-26 11:04 Nick Piggin
2004-05-26 6:38 Anthony DiSante
2004-05-26 7:31 ` Buddy Lumpkin
2004-05-26 7:55 ` William Lee Irwin III
2004-05-26 8:30 ` Buddy Lumpkin
2004-05-26 8:44 ` Nick Piggin
2004-05-26 9:34 ` John Bradford
2004-05-26 9:48 ` Nick Piggin
2004-05-26 10:10 ` Matthias Schniedermeyer
2004-05-26 10:33 ` Nick Piggin
2004-05-26 10:58 ` Matthias Schniedermeyer
2004-05-26 11:19 ` Nick Piggin
2004-05-26 12:27 ` Matthias Schniedermeyer
2004-05-27 5:38 ` Nick Piggin
2004-05-26 12:37 ` Matthias Schniedermeyer
2004-05-26 13:06 ` Gianni Tedesco
2004-05-26 13:41 ` Matt H.
2004-05-26 13:55 ` Buddy Lumpkin
2004-05-27 5:14 ` Tom Felker
2004-05-27 6:02 ` Nick Piggin
2004-05-27 7:04 ` Bernd Eckenfels
2004-05-27 7:16 ` Oliver Neukum
2004-05-26 10:45 ` Martin Olsson
2004-05-26 11:25 ` Nick Piggin
2004-05-26 16:33 ` David Schwartz
2004-05-26 16:58 ` John Bradford
2004-05-26 23:32 ` Kyle Moffett
2004-05-27 8:05 ` John Bradford
2004-05-26 10:46 ` John Bradford
2004-05-26 11:46 ` Buddy Lumpkin
2004-05-26 11:39 ` Buddy Lumpkin
2004-05-26 9:42 ` Anthony DiSante
2004-05-26 9:58 ` Nick Piggin
2004-05-26 20:11 ` Wakko Warner
2004-05-27 5:59 ` Nick Piggin
2004-05-27 14:34 ` Wakko Warner
2004-05-26 10:40 ` Buddy Lumpkin
2004-05-26 13:15 ` Helge Hafting
2004-05-26 9:09 ` William Lee Irwin III
2004-05-26 11:38 ` Buddy Lumpkin
2004-05-26 12:12 ` Paulo Marques
2004-05-26 12:14 ` Nick Piggin
2004-05-26 12:40 ` Denis Vlasenko
2004-05-26 10:41 ` Denis Vlasenko
2004-05-26 12:07 ` Buddy Lumpkin
2004-05-26 12:06 ` Marc-Christian Petersen
2004-05-26 12:19 ` Denis Vlasenko
2004-05-26 13:48 ` Buddy Lumpkin
2004-05-26 12:33 ` Richard B. Johnson
2004-05-26 13:25 ` Buddy Lumpkin
2004-05-26 12:30 ` Rik van Riel
2004-05-26 10:44 ` Denis Vlasenko
2004-05-26 11:49 ` Buddy Lumpkin
2004-05-26 12:19 ` Rik van Riel
2004-05-26 12:55 ` Buddy Lumpkin
2004-05-26 8:27 ` Roger Luethi
2004-05-26 9:23 ` John Bradford
2004-05-26 9:30 ` Roger Luethi
2004-05-26 10:35 ` John Bradford
2004-05-26 10:37 ` Nick Piggin
2004-05-26 10:48 ` John Bradford
2004-05-26 13:01 ` Helge Hafting
2004-05-26 8:32 ` Denis Vlasenko
2004-05-26 9:00 ` Helge Hafting
2004-05-26 9:40 ` John Bradford
2004-05-26 13:06 ` Helge Hafting
2004-05-26 9:06 ` John Bradford
2004-05-26 12:31 ` Buddy Lumpkin
2004-05-26 10:02 ` Raphael Jacquot
2004-05-26 13:00 ` Satoshi Oshima
2004-05-26 13:38 ` William Lee Irwin III
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=40B5D359.2030702@myrealbox.com \
--to=luto@myrealbox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ms@citd.de \
--cc=nickpiggin@yahoo.com.au \
--cc=tcfelker@mtco.com \
/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