Very bad behavior of kswapd

Laurent Chavet (lchavet@av.com)
Wed, 18 Apr 2001 02:56:45 -0700


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 ?

Laurent Chavet

-
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/