Linux 2.1.X virtual memory odities

Pavel Machek (
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?


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

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


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;
printk( "(%dK)\n", i*4 );

I'm really 	   Pavel
Look at ;-).