linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Ross Biro <rossb@google.com>
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: linux-2.4.21 released
Date: Sat, 14 Jun 2003 04:02:52 +0200	[thread overview]
Message-ID: <20030614020252.GA1571@dualathlon.random> (raw)
In-Reply-To: <3EEA24E0.7030801@google.com>

On Fri, Jun 13, 2003 at 12:24:16PM -0700, Ross Biro wrote:
> Here's a minor patch against 2.4.21 that should help reduce out of 
> memory problems on high ram systems with no swap space.  It's only been 
> minimally tested in 2.4.21, but I've been running something similiar on 
> 2.4.18 for a bit now.

this is the wrong approch IMHO, you shouldn't put those into the LRU
list in the first place if there's no swap, that is the totally wasteful
thing in the first place ;)

see my vm_lru_anon scalability patch in my tree, that patch improves
scalability of some workload in a big smp up to hundred percent and it
does exactly that. 

We should join the sysctl check with an && with the swap_avail().
However since I leave it disabled by default, my tree already works
perfectly w/ or w/o swap until you go tweak the sysctl. So I hope
you will tweak it only when there's effectively swap ;).

The real reason I had to make that change is been primarly for
scalability reasons, no way at all we can take a spinlock for every
anonymous page that is allocated (and of course there's no rmap). That
generates an huge amount of cpu wasted in cacheline bouncing in all
common workloads. It gets all the system time in the pagecache_lru_lock
that way.

The patch I'm talking about is this:

	http://www.us.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.21rc8aa1/05_vm_22_vm-anon-lru-1

please try it and let me know. feel free to test with an && between the
sysctl and your swap_avail, I would certainly merge that change.



> 
>    Ross
> 
> 

> diff -urbBd linux-2.4.21/include/linux/swap.h linux-2.4.21-1/include/linux/swap.h
> --- linux-2.4.21/include/linux/swap.h	Fri Jun 13 07:51:39 2003
> +++ linux-2.4.21-1/include/linux/swap.h	Fri Jun 13 10:40:24 2003
> @@ -82,6 +82,7 @@
>  
>  /* Swap 50% full? Release swapcache more aggressively.. */
>  #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
> +#define swap_avail() (nr_swap_pages > 0)
>  
>  extern unsigned int nr_free_pages(void);
>  extern unsigned int nr_free_buffer_pages(void);
> diff -urbBd linux-2.4.21/mm/vmscan.c linux-2.4.21-1/mm/vmscan.c
> --- linux-2.4.21/mm/vmscan.c	Thu Nov 28 15:53:15 2002
> +++ linux-2.4.21-1/mm/vmscan.c	Fri Jun 13 11:26:26 2003
> @@ -474,6 +474,18 @@
>  			spin_unlock(&pagecache_lock);
>  			UnlockPage(page);
>  page_mapped:
> +                        /* if we don't have swap, it doesn't
> +                           do much good to swap things out. */
> +			if (!page->mapping && !swap_avail()) {
> +				/* Let's make the page active since we
> +				   cannot swap it out.  It gets it off
> +				   the inactive list. */
> +				spin_unlock(&pagemap_lru_lock);
> +				activate_page(page);
> +				ClearPageReferenced(page);
> +				spin_lock(&pagemap_lru_lock);
> +				continue;
> +			}
>  			if (--max_mapped >= 0)
>  				continue;
>  



Andrea

  reply	other threads:[~2003-06-14  1:48 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-13 14:53 linux-2.4.21 released Marcelo Tosatti
2003-06-13 16:56 ` Stefan Foerster
2003-06-13 16:56   ` Damian Kolkowski
2003-06-13 17:37     ` Stephan von Krawczynski
2003-06-13 17:19       ` Damian Kołkowski
2003-06-13 17:49         ` Alan Cox
2003-06-13 17:45           ` Damian Kolkowski
2003-06-13 18:36           ` Damian Kołkowski
2003-06-13 21:04             ` Daniel Egger
2003-06-13 21:31               ` Damian Kołkowski
2003-06-15 14:29                 ` Daniel Egger
2003-06-14 15:59         ` Krzysiek Taraszka
2003-06-14 16:16           ` Damian Kołkowski
2003-06-13 18:10     ` Serguei Miridonov
2003-06-13 17:22   ` Matthias Andree
2003-06-13 17:29     ` Christoph Hellwig
2003-06-14 21:35       ` Diego Calleja García
2003-06-14 21:58         ` Ramón Rey Vicente󮠒
2003-06-15 12:02         ` Matthias Andree
2003-06-13 18:56     ` Ramón Rey Vicente󮠒ey Vicente
2003-06-13 20:03       ` Robert Love
2003-06-13 20:27         ` Ramón Rey Vicente󮠒
2003-06-13 21:50     ` J.A. Magallon
2003-06-14  7:31     ` Wiktor Wodecki
2003-06-13 19:14 ` Udo A. Steinberg
2003-06-13 19:24   ` Ross Biro
2003-06-14  2:02     ` Andrea Arcangeli [this message]
2003-06-14  4:28 ` Ben Collins
2003-06-14 15:36 ` CJ
2003-06-14 15:54   ` Jörn Engel
2003-06-14 16:29     ` CJ
2003-06-15 19:06       ` Jörn Engel
2003-06-15 19:49 ` linux-2.4.21 released , No changelog for sym53c8xx_2 mods ? Mr. James W. Laferriere
2003-06-16 22:22 ` linux-2.4.21 released Lukasz Trabinski
2003-06-13 16:40 Go Marcelo
2003-06-16  0:34 Fr�d�ric L. W. Meunier
2003-06-22 18:51 Fr�d�ric L. W. Meunier
2003-06-22 19:46 Nicolas Mailhot

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=20030614020252.GA1571@dualathlon.random \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=rossb@google.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;
as well as URLs for NNTP newsgroup(s).