Re: Linux 2.1.X virtual memory odities

Mark Hemment (
Tue, 29 Jul 1997 10:24:13 +0100 (BST)


On Mon, 28 Jul 1997, Pavel Machek wrote:
> [System is 486DX with 20meg of ram and enough swap space]
> ~~~~~~~~~~~~~~~~~
Swap dosen't really come into play with the code example below.

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

Memory allocated via kmalloc() (or kmem_cache_alloc()) is _not_ pagable!
Consider it has kernel-memory, which has to live in physical memory.
Pagable memory will, of course, be paged-out/released to make space for
kernel memory.

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

Not broken. A case of "pilot error".



Mark Hemment, Unix/C Software Engineer (Contractor)
"Success has many fathers, failure is a B**TARD!" - anon