get_free_pages... and free_pages..

Raj, Ashok (ashok.raj@intel.com)
Mon, 16 Aug 1999 08:37:54 -0700


Hello.

I need my test driver to allocate some memory that is physically contigues.
the way i do it is

user program issues a mmap() call to the driver with a specific offset.
when this value is identified in the kernel the driver does the following.

kernel:
buf = __get_free_pages(...);
for (i = MAP_NR(buf); i<=MAP_NR(buf + size -1);i++)
set_bit(PG_reserved, &mem_map[i].flags);
paddr = __pa(buf);

if (remap_page_range(vma->vm_start, paddr, size, vma->vm_page_prot))
return -EAGAIN;
else
return 0;

when the user process closes the handle while the release() procedure is
getting called i do the reverse of the above

- clear_bit(PG_reserved)
- free_pages()

this seems to work fine, except that after the free pages still i dont see
the available memory increasing in /proc/meminfo. so the memory leaks and
finally iam not able to allocate using __get_free_pages(). is something
wrong here from what iam doing?

ashokr

Cheers,
ashokr

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/