lkml.org 
[lkml]   [2001]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Very bad behavior of kswapd
On Wed, 18 Apr 2001, Laurent Chavet wrote:

> Try this (my example I've 2GB of ram)
>
> turn all your swap off
>
> dd about 15% of the size of your RAM:
> dd if=/dev/zero of=/local/test count=300 bs=1000000
>
> Run this program with SIZE about 95% of your RAM:
>
> #include <stdlib.h>
> #include <unistd.h>
> #include <assert.h>
>
> #define SIZE (1900 * 1024 * 1024)
> int main()
> {
> int i;
> char *p = malloc(SIZE);
> assert (p != NULL);
> for (i = 0; i < SIZE; i++)
> p[i] = 1;
> printf ("done %p\n", p);
>
> while (1)
> {
> sleep (60);
> }
> return 0;
> }
>
>
> Watch top: when this program needs the memory that kswapd keep
> in cache they go both at 100% cpu (on SMP) but still the size of
> the program only grows at about 100KB/s, why is kswapd releasing
> it so slowly and taking so much CPU ?

Because kswapd still has to scan all the (unfreeable) memory
of the big process to determine it isn't freeable.

At the moment kswapd is really stupid about these corner-case
situations, please bear with us while we fix it ...

... and don't forget to fill in a bugzilla item on the
Linux-MM bugzilla ;)

regards,

Rik
--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

http://www.surriel.com/
http://www.conectiva.com/ http://distro.conectiva.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.059 / U:5.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site