free space

How to determine Amount of free kernel memory and problem with __get_free_pages()

Submitted by Anonymous
on May 4, 2010 - 8:41pm

I want to write a loop that sucks up all the 2mb slugs of memory I can get in the kernel. However, I want to leave "some" free space (say 20% of the machine's total phys mem). So, how can I do that? I have a loop now something like as an experiment to get all the mem I can and then release enough for the system to continue running but the kernel hangs:

for( i = 0; i < MAX_SLUGS; ++i )
{