From: Linus Torvalds <torvalds@transmeta.com>
To: "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>
Cc: "Benjamin C.R. LaHaise" <blah@kvack.org>,
Rik van Riel <H.H.vanRiel@fys.ruu.nl>,
Itai Nahshon <nahshon@actcom.co.il>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
paubert@iram.es, linux-kernel@vger.rutgers.edu,
Ingo Molnar <mingo@chiara.csoma.elte.hu>,
linux-mm@kvack.org
Subject: Re: Fairness in love and swapping
Date: Wed, 25 Feb 1998 13:02:02 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.3.95.980225125221.8068A-100000@penguin.transmeta.com> (raw)
In-Reply-To: <199802252032.UAA01920@dax.dcs.ed.ac.uk>
On Wed, 25 Feb 1998, Stephen C. Tweedie wrote:
>
> I noticed something rather unfortunate when starting up two of these
> tests simultaneously, each test using a bit less than total physical
> memory. The first test gobbled up the whole of ram as expected, but the
> second test did not. What happened was that the contention for memory
> was keeping swap active all the time, but the processes which were
> already all in memory just kept running at full speed and so their pages
> all remained fresh in the page age table. The newcomer processes were
> never able to keep a page in memory long enough for their age to compete
> with the old process' pages, and so I had a number of identical
> processes, half of which were fully swapped in and half of which were
> swapping madly.
>
> Needless to say, this is highly unfair, but I'm not sure whether there
> is any easy way round it --- any clock algorithm will have the same
> problem, unless we start implementing dynamic resident set size limits.
Yes. This is similar to what I observed when I (a long time ago) made the
swap-out a lot more strictly "least recently used": what that ended up
showing very clearly was that interactive processes got swapped out very
aggressively indeed, because they had tended to touch their pages much
less than the memory-hogging ones..
What I _think_ should be done is that every time the accessed bit is
cleared in a process during the clock scan, the "swap-out priority" of
that process is _increased_. Right now it works the other way around:
having the accessed bit set _decreases_ the priority for swapping, because
the pager thinks that that page shouldn't be paged out.
Note that these are two different priorities: you have a "per-page"
priority and a "per-process" priority, and they should have a reverse
relationship: being accessed should obviously make the "per-page" thing
less likely to page out, but it should make the "per process" thing _more_
likely to page out.
The per-page thing we already obviously have. And we currently have
something that comes close to being a "per process" priority, which is
the "p->swap_cnt" thing. But it is not updated on accessed bits, but
rather differently based on the rss, and there is precious little
interaction between the two: at some point we should make the comparison
between "is the per-page priority lower than the per-process priority"?
Right now we have a "absolute" comparison of the per-page priority for
determining whether to throw the page out or not, which isn't associated
with the per-process priority at all.
(Note: in this context "per-process" really is "per-page-table", ie it
should probably be in p->mm->swap_cnt rather than in p->swap_cnt..)
I think this is something to look at..
Linus
next prev parent reply other threads:[~1998-02-25 21:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-02-25 20:32 Stephen C. Tweedie
1998-02-25 21:02 ` Linus Torvalds [this message]
1998-02-25 21:44 ` Rik van Riel
1998-02-25 21:39 ` Dr. Werner Fink
1998-02-25 22:27 ` Rik van Riel
1998-02-26 11:03 ` Dr. Werner Fink
1998-02-26 11:34 ` Rik van Riel
1998-02-26 18:57 ` Dr. Werner Fink
1998-02-26 19:32 ` Rik van Riel
1998-02-26 22:44 ` Stephen C. Tweedie
1998-02-26 23:34 ` Rik van Riel
1998-02-27 19:41 ` Stephen C. Tweedie
1998-03-02 16:19 ` Rik van Riel
1998-03-02 22:35 ` Stephen C. Tweedie
1998-03-02 23:14 ` Rik van Riel
1998-03-03 22:59 ` Stephen C. Tweedie
1998-02-26 8:05 ` Rogier Wolff
1998-02-26 13:00 ` Dr. Werner Fink
1998-02-26 22:36 ` Stephen C. Tweedie
1998-02-26 23:20 ` Dr. Werner Fink
1998-02-26 14:30 ` Rik van Riel
1998-02-26 22:41 ` Stephen C. Tweedie
1998-02-26 23:21 ` Rik van Riel
1998-02-26 22:33 ` Stephen C. Tweedie
1998-02-26 22:49 ` Rik van Riel
1998-02-27 2:56 ` Michael O'Reilly
[not found] <199802270729.IAA00680@cave.BitWizard.nl>
1998-02-27 11:26 ` Rik van Riel
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=Pine.LNX.3.95.980225125221.8068A-100000@penguin.transmeta.com \
--to=torvalds@transmeta.com \
--cc=H.H.vanRiel@fys.ruu.nl \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=blah@kvack.org \
--cc=linux-kernel@vger.rutgers.edu \
--cc=linux-mm@kvack.org \
--cc=mingo@chiara.csoma.elte.hu \
--cc=nahshon@actcom.co.il \
--cc=paubert@iram.es \
--cc=sct@dcs.ed.ac.uk \
/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