On Thu, 07 Apr 2011 19:21:05 +0200, Dave Hansen <dave@xxxxxxxxxxxxxxxxxx>
wrote:
+struct page *__alloc_pages_exact(gfp_t gfp_mask, size_t size)
{
unsigned int order = get_order(size);
- unsigned long addr;
+ struct page *page;
- addr = __get_free_pages(gfp_mask, order);
- if (addr) {
- unsigned long alloc_end = addr + (PAGE_SIZE << order);
- unsigned long used = addr + PAGE_ALIGN(size);
+ page = alloc_pages(gfp_mask, order);
+ if (page) {
+ struct page *alloc_end = page + (1 << order);
+ struct page *used = page + PAGE_ALIGN(size)/PAGE_SIZE;
- split_page(virt_to_page((void *)addr), order);
+ split_page(page, order);
while (used < alloc_end) {
- free_page(used);
- used += PAGE_SIZE;
+ __free_page(used);
+ used++;
}
Have you thought about moving this loop to a separate function, ie.
_free_page_range(start, end)? I'm asking because this loop appears
in two places and my CMA would also benefit from such a function.
}
- return (void *)addr;
+ return page;
+}
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-----<email/xmpp: mnazarewicz@xxxxxxxxxx>-----ooO--(_)--Ooo--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>