Linux 2.1.X virtual memory odities

Pavel Machek (pavel@Elf.mj.gts.cz)
Mon, 28 Jul 1997 20:09:22 +0200


Hi, kernel hackers.

And vm hackers please listen.

[System is 486DX with 20meg of ram and enough swap space]
~~~~~~~~~~~~~~~~~

Linux is expected to keep nr_free_pages > reserved_pages. Right? So,
if system is idle, and you wait some time and then ask for atomic
memory, you'll get some. Right?

NO!

Tested under 2.1.46, I patched sysrq.c to alloc all available memory
using kmalloc with GFP_ATOMIC in 3K chunks... [BTW kmalloc(1) seems to
do strange things under 2.1.47].

>From 2.1.47

........................(13164K)
SysRq: Eating pages ............................(112K)
SysRq: Eating pages ....(16K)
SysRq: Eating pages (0K)
SysRq: Eating pages (0K)
[10 sec passed]
bash: [10: command not found
pavel@Elf:~$ SysRq: Eating pages (0K)

System was idle all the time. Looks to me like there's something
seriously broken in there... There was enough swap, so that memory
_should_ get freed. 100% reproducible in here...

Pavel

Quote from sysrq.c:

case 'w': /* W -- eat physical memory */
{
int i = 0;
void **c= eaten_memory, *m;
printk( "Eating pages " );
while ((m = kmalloc( 3500, GFP_ATOMIC )))
{
eaten_memory = m;
printk( "." );
*eaten_memory = c;
c = eaten_memory;
i++;
}
printk( "(%dK)\n", i*4 );
}
break;

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).