Memory Swap problem

Richard B. Johnson (root@analogic.com)
Wed, 11 Dec 1996 11:42:27 -0500 (EST)


Your patch made my system behave much better. Here's some test code that
I hacked up to test it.

#include <stdio.h>
#include <malloc.h>

int main(void);
int main()
{
int *p, *q;
size_t len;
size_t i;
len = 13117; /* Not divisible into a page */
for(;;)
{
fprintf(stdout, "Allocation = %u\r", len);
fflush(stdout);
if((p = (int *) malloc(len * sizeof(int))) == NULL)
{
fprintf(stderr, "Memory allocation finally failed at %u words\n",
len);
len = 13117;
continue;
}
q = p;
for(i=0; i<len; i++)
*q++ = i;
free(p);
len += (size_t) ((float)len * 1.3332);
}
return 0;
}

It appears to run "forever" okay. Without your patch, paging was racing
so that I couldn't get any CPU time to stop anything. I have a very
fast SCSI disk used for swap plus an Adaptec AHA-2940 PCI controller.

Cheers,
Dick Johnson
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard B. Johnson
Project Engineer
Analogic Corporation
Voice : (508) 977-3000 ext. 3754
Fax : (508) 532-6097
Modem : (508) 977-6870
Ftp : ftp@boneserver.analogic.com
Email : rjohnson@analogic.com, johnson@analogic.com
Penguin : Linux version 2.1.14 on an i586 machine.
Warning : It's hard to remain at the trailing edge of technology.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-