lkml.org 
[lkml]   [1999]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject2.3.33: ugly swapper/mm bug
This looks like a leak somewhere.  Config:  x86, P-II SMP, PIIX IDE DMA
for data and swap.

Maybe this is related to block queueing code. Swapping on a 2.3.2x
kernel was smooth like butter on my system. Now the swapper is very
choppy under, freezing the system for a second or two at a time while
heavily swapping.

After loading up X and my desktop and Netscape, I often run fillmem[1]
to force most everything to swap out to disk. fillmem is a simple
memory dirtying tool, which mallocs and dirties a number of 1MB
buffers. I have 128MB of physical RAM, so I run 'fillmem 128' to
allocate and dirty 128 buffers.

I think there is a leak or race in the swapper. fillmem run #1:

$ fillmem 128 # succeeds, but very choppy, maybe leaky.
$ cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 129187840 78782464 50405376 0 475136 15572992
Swap: 641490944 43253760
598237184

$ fillmem 128 # succeeds, but very choppy, looks really leaky.
$ cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 129187840 13422592 115765248 0 401408 6008832
Swap: 641490944 97046528
544444416

$ fillmem 128 # fails, segfault
$ cat /proc/meminfo # after a few minutes to type this msg
total: used: free: shared: buffers: cached:
Mem: 129187840 76845056 52342784 0 585728 58859520
Swap: 641490944 101732352
539758592

Source to fillmem:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define MEGS 140
#define MEG (1024 * 1024)

int main (int argc, char *argv[])
{
void **data;
int i, r;
size_t megs = MEGS;

if ((argc >= 2) && (atoi(argv[1]) > 0))
megs = atoi(argv[1]);

data = malloc (megs * sizeof (void*));
if (!data) abort();

memset (data, 0, megs * sizeof (void*));

srand(time(NULL));

for (i = 0; i < megs; i++) {
data[i] = malloc(MEG);
memset (data[i], i, MEG);
printf("malloc/memset %03d/%03d\n", i+1, megs);
}
for (i = 0; i < megs; i++) {
r = rand() % 200;
memset (data[i], r, MEG);
printf("memset #2 %03d/%03d = %d\n", i+1, megs, r);
}
printf("done\n");
return 0;
}
--
Jeff Garzik | Just once, I wish we would encounter
Building 1024 | an alien menace that wasn't immune to
MandrakeSoft, Inc. | bullets. -- The Brigadier, "Dr. Who"

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

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