[lkml]   [2001]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectkernel hangs in 118th call to vmalloc
I'm writing a driver for the 2.4.2 kernel.  I need to use this kernel 
because this driver needs to be compatible with a stock Red Hat system.
Patches to the kernel are not an option.

The purpose of the driver is to locate a device that exists on a
specific memory chip. To help find it, I've written this routine:

#define CLEAR_BLOCK_SIZE 1048576UL // must be a multiple of 1MB

void clear_out_memory(void)
unsigned i;
unsigned long size = 0;

for (i=0; i<CLEAR_BLOCK_COUNT; i++)
p[i] = vmalloc(CLEAR_BLOCK_SIZE);
if (!p[i])

while (--i)

printk("Paged %luMB of memory\n", size / 1048576UL);

What this routine does is call vmalloc() repeatedly for a number of 1MB
chunks until it fails or until it's allocated 128MB (CLEAR_BLOCK_COUNT
is equal to 128 in this case). Then, it starts freeing them.

The side-effect of this routine is to page-out up to 128MB of RAM.
Unfortunately, on a 128MB machine, the 118th call to vmalloc() hangs the
system. I was expecting it to return NULL instead.

Is this a bug in vmalloc()? If so, is there a work-around that I can use?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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