[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Page allocation and de-allocation



On Thu, Oct 06, 2005 at 15:07:50 +1300, Xiangfei Jia wrote:
> I'm using an array to hold number of pages. The array is allocated using
> vmalloc

Using vmalloc? So it's a large array. Thousands of entries, right?
      ^

> and each page is allocated by get_free_page(GFP_ATOMIC). And after
					     ^
	      You are NOT using get_free_pages, right?
	                                     ^

> use, the number of pages are free-ed by __free_page().

Do you check that get_free_page actually returns non-NULL? It is hell lot
likely to return NULL in GFP_ATOMIC mode. That mode is simply not reliable --
you must live with it.

> The system works fine if the array of pages are allocated for the first time
> since the system started running. If I try to allocate the same amount of
> pages for the second time, the system will crash. Even if I try to allocate
> less pages, the system still crashes. It seems to me that the the pages been
> allocated are not really free-ed. Or maybe due to some other problems. Can
> someone help me with this. Really appropriated!!

Not really. Memory allocation is a tricky area. You need to show the real
code. Not just explanation -- actual code that does not work for you.

--
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature