Re: Calling free_pages on part of the memory returned by get_free_pages?
From: Timur Tabi
Date: Thu Apr 24 2008 - 15:32:47 EST
Andi Kleen wrote:
> It is ok, as long as you don't use compound pages (__GFP_COMP) and call
> split_page() to fix up the reference counts.
Thanks. I've never even heard of compound pages, so that's not a problem. I'll
look up split_page().
> Also you do this to save memory right?
Yes, I expect to allocate a 5MB chunk of memory, which means I'll be wasting 3MB
of physically-contiguous memory on an embedded system.
> The large system hash code does it too
Ah, I see that in alloc_large_system_hash(). Thanks
> If it's reasonably common we should re-add alloc/get_pages_exact() helper to
> make this pattern clear and easier to use.
I'd be in favor of that! I was planning on doing something like that anyway.
--
Timur Tabi
Linux kernel developer at Freescale
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/