linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@transmeta.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Rik van Riel <H.H.vanRiel@phys.uu.nl>,
	Linux MM <linux-mm@kvack.org>,
	Andrea Arcangeli <andrea@e-mind.com>,
	Alan Cox <number6@the-village.bc.nu>
Subject: Re: New patch (was Re: [PATCH] swapin readahead v3 + kswapd fixes)
Date: Sat, 19 Dec 1998 10:41:51 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.3.95.981219102446.15343F-100000@penguin.transmeta.com> (raw)
In-Reply-To: <199812191709.RAA01245@dax.scot.redhat.com>



On Sat, 19 Dec 1998, Stephen C. Tweedie wrote:
> 
> Linus, I've had a test with your 132-pre2 patch, and the performance is
> really disappointing in some important cases.  Particular effects I can
> reproduce with it include:

Try a really trivial change, which is to start the page_out priority from
8 instead of 6 (maybe 7 is the right balance, but let's try 8 first. 

The problem, I suspect, is simply that the new code obviously _always_
calls "shrink_mmap()", and with a priority of 6 shrink_mmap() is a bit too
good at throwing out page cache pages etc, so we tend to wait a bit too
long before we actually start to swap out user pages instead. 

Previously we didn't have that problem, because once we got over
shrink_mmap() due to any problem what-so-ever, then we didn't tend to
re-enter it very easily. Obviously sometimes it was _too_ hard to re-enter
it, which is why we had all the ugly hacks to magically sometimes force
our state to shrink_mmap(). 

> The problem that we have with the strict state-driven logic in
> do_try_to_free_page is that, for prolonged periods, it can bypass the
> normal shrink_mmap() loop which we _do_ want to keep active even while
> swapping.  However, I think that the 132-pre2 cure is worse than the
> disease, because it penalises swap to such an extent that we lose the
> substantial performance benefit that comes from being able to stream
> both to and from swap rapidly.

Right. It's essentially not likely enough to start swapping. 

> The patch below is the best I have so far against 132-pre2.  You will
> find that it has absolutely no references to the borrow percentages, and
> although it does honour the buffer/pgcache min percentages, those
> default to 1%.

Can you try the even siompler patch of just changing

	int i=6;

to

	int i=8;

in do_try_to_free_page()? I suspect that's actually enough.

Basically, let's think about the problem analytically before we add any
"magic rules". That's what I tried to do with the pre-2 patch, and
basically the pre-2 patch has a _very_ simple lay-out:

   Always start with "shrink_mmap()", because that's the "simple" case,
   and gets rid of excessive page caches etc. HOWEVER, make
   "shrink_mmap()" initially timid enough, that if it doesn't find a nice
   page quickly, we then try to really swap things out.

Basically, there are no magic rules, no made-up "in this case we do that" 
setup. The only issue is one of "how timid are we initially" to get a good
balance. 

With a value of 6, it means that we try to see if we can find a page we
can easily throw out in the first 1/32th of the memory we test. That
sounds fairly timid, but it really isn't all that timid at all: if we have
even just a third of all pages being buffer cache pages, it's actually
fairly likely that we'd throw out that instead of trying to page anything
out. 

A initial "timidity" value of 8 means that we'd throw out a page from the
page map only if we find it really easily (ie we only look at 1/128th of
our memory). That may be too timid (and maybe 7 is right), but basically I
think this approach should work reasonably well for a wide range of memory
sizes. And I _really_ really want to try something without any silly magic
rules first. 

In short, first prove to me somehow that the rule _has_ to be there. 
Either by some argument that makes it obvious, or by showing that the
above simple change really doesn't work. 

		Linus

--
This is a majordomo managed list.  To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org

  reply	other threads:[~1998-12-19 18:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-01  6:55 [PATCH] swapin readahead v3 + kswapd fixes Rik van Riel
1998-12-01  8:15 ` Andrea Arcangeli
1998-12-01 15:28   ` Rik van Riel
1998-12-17  1:24 ` Linus Torvalds
1998-12-19 17:09   ` New patch (was Re: [PATCH] swapin readahead v3 + kswapd fixes) Stephen C. Tweedie
1998-12-19 18:41     ` Linus Torvalds [this message]
1998-12-19 19:41     ` Linus Torvalds
1998-12-19 22:01       ` Stephen C. Tweedie
1998-12-20  3:05         ` Linus Torvalds
1998-12-20 14:18         ` Linus Torvalds
1998-12-21 13:03           ` Andrea Arcangeli
1998-12-21 13:39           ` Stephen C. Tweedie
1998-12-21 14:08             ` Andrea Arcangeli
1998-12-21 16:42               ` Stephen C. Tweedie
1998-12-21  9:53     ` Andrea Arcangeli
1998-12-21 16:37       ` Stephen C. Tweedie
1998-12-21 17:58         ` Linus Torvalds
1998-12-21 18:59           ` Stephen C. Tweedie
1998-12-21 19:38             ` Linus Torvalds
1998-12-22  7:56           ` Eric W. Biederman
1998-12-22 10:49             ` Andrea Arcangeli
1998-12-22 15:32               ` Eric W. Biederman
1998-12-22 15:40                 ` Andrea Arcangeli
1998-12-22 16:26                   ` Linus Torvalds
1998-12-22 19:55                     ` Eric W. Biederman
1998-12-22 20:25                     ` Rik van Riel
1998-12-22 21:56                       ` Linus Torvalds
1998-12-22 20:10                   ` Rik van Riel
1998-12-22 22:35                     ` Andrea Arcangeli
1998-12-23  8:45                       ` Rik van Riel
1998-12-22 20:03                 ` Rik van Riel
1998-12-22 17:23               ` [patch] swap_out now really free (the right) pages [Re: New patch (was Re: [PATCH] swapin readahead v3 + kswapd fixes)] Andrea Arcangeli

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.981219102446.15343F-100000@penguin.transmeta.com \
    --to=torvalds@transmeta.com \
    --cc=H.H.vanRiel@phys.uu.nl \
    --cc=andrea@e-mind.com \
    --cc=linux-mm@kvack.org \
    --cc=number6@the-village.bc.nu \
    --cc=sct@redhat.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