linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rajagopal Ananthanarayanan <ananth@sgi.com>
To: riel@nl.linux.org
Cc: Benjamin Redelings I <bredelin@ucla.edu>,
	Linus Torvalds <torvalds@transmeta.com>,
	linux-mm@kvack.org
Subject: Re: [DATAPOINT] pre7-6 will not swap
Date: Sat, 06 May 2000 15:24:01 -0700	[thread overview]
Message-ID: <39149B81.B92C8741@sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.21.0005061844560.4627-100000@duckman.conectiva>

Rik van Riel wrote:
> 
> On Fri, 5 May 2000, Benjamin Redelings I wrote:
> 
> >       It looks like some processes (my unused daemons) are
> > scanned only once, and then get stuck at the end of some list?
> > Is that a possible explanation? <guessing> Perhaps Rik's moving
> > list-head idea is needed? </guessing>.
> 
> I'm busy implementing Davem's active/inactive list proposal
> to replace the current page/swapcache. I don't know if it'll
> work really well though, so research into other directions
> is very much welcome ;)
> 

Again my experience, with skipping pages whose zones have
(free_pages > pages_high) in try_to_swap_out, is similar to
Benajamin's ... the system behaves better than 7-4, but
isn't as good as without any zone skipping.

Once again, I'm back to asking, should we be swapping at all?
Shouldn't shrink_mmap() be finding pages to throw out?

I have a hunch. Follow this argument closely. In shrink_mmap we have:

------------
	if (p_zone->free_pages > p_zone->pages_high)
                        goto dispose_continue;
------

This page doesn't count against a valid try in shrink_mmap().
Soon, we run out of pages to look at, but "count" in shrink_mmap is
still high. So, we go back to scanning the lru list all over again.
If some pages' reference count was flipped in the first loop, good.
If it wasn't, and all that remained was unreferenced pages whose
zones have reached the high water mark, then they won't be victimized,
because the same test above will skip the page again!

Still on the second loop, shrink_mmap will look at other pages,
for instance because an I/O is in flight, and _those_ pages do tally
against "count" ... so, in essense, we have skipped unreferenced pages
belonging to zones with high water mark, for ever. This is wrong.

My solution is simple. Have a variable, "second_scan" initialized to zero,
at the top of shrink_mmap(). Set "second_scan = 1" at the bottom of the loop
in shrink_mmap:

---------------
	/* wrong zone?  not looped too often?    roll again... */
        if (page->zone != zone && count) {
		second_scan = 1;
                goto again;
	}
-------------

Now the pages_high test will be changed to:

-----------
	 if (p_zone->free_pages > p_zone->pages_high && !second_scan)
                        goto dispose_continue;
-----------

That is, victimize pages in zones with lots of free_pages if having
scanned once we didn't find anything.

If you are worried about unreferenced pages not being looked at in
the second_scan, we can change it to a third_scan.

Now, the final argument: since this page was skipped by shrink_mmap(),
the test in try_to_swap_out that Benjamin, I and Linus have been playing
around becomes important. Without it, pages in zones with lots of
free memory neither get "shrunk" nor get swapped.

What do you guys think?

--------------------------------------------------------------------------
Rajagopal Ananthanarayanan ("ananth")
Member Technical Staff, SGI.
--------------------------------------------------------------------------
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

  reply	other threads:[~2000-05-06 22:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8evk0f$7jote$1@fido.engr.sgi.com>
2000-05-06 17:12 ` Rajagopal Ananthanarayanan
2000-05-06  4:25   ` Benjamin Redelings I
2000-05-06 19:35   ` Linus Torvalds
2000-05-06  5:35     ` Benjamin Redelings I
2000-05-06 21:46       ` Rik van Riel
2000-05-06 22:24         ` Rajagopal Ananthanarayanan [this message]
2000-05-06 14:03           ` Benjamin Redelings I
2000-05-07  0:22           ` Rik van Riel
2000-05-07  2:23           ` Linus Torvalds
2000-05-07 17:40             ` Rik van Riel
2000-05-07 17:53               ` Linus Torvalds
2000-05-07 19:13                 ` Rajagopal Ananthanarayanan
2000-05-07 19:30                   ` Linus Torvalds
2000-05-08 20:40                     ` gprof data for pre7-6 Rajagopal Ananthanarayanan
2000-05-09  1:52     ` [DATAPOINT] pre7-6 will not swap Quintela Carreira Juan J.
2000-05-09  2:28       ` Rajagopal Ananthanarayanan
2000-05-09  2:33       ` Linus Torvalds
2000-05-09  3:31         ` Rajagopal Ananthanarayanan
2000-05-09 15:56           ` [DATAPOINT] pre7-8 swaps with FREE mem? Benjamin Redelings I
2000-05-06 20:12   ` PG_referenced and lru_cache (cpu%) Roger Larsson
2000-05-06 18:31     ` Rik van Riel
2000-05-06 22:16       ` Roger Larsson
2000-05-05  8:07 [DATAPOINT] pre7-6 will not swap Benjamin Redelings I

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=39149B81.B92C8741@sgi.com \
    --to=ananth@sgi.com \
    --cc=bredelin@ucla.edu \
    --cc=linux-mm@kvack.org \
    --cc=riel@nl.linux.org \
    --cc=torvalds@transmeta.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