Re: [PATCH 2/2] make new alloc_pages_exact()

From: Dave Hansen
Date: Fri Apr 08 2011 - 18:07:11 EST


On Fri, 2011-04-08 at 14:28 +0200, Michal Nazarewicz wrote:
> On Thu, 07 Apr 2011 19:21:05 +0200, Dave Hansen <dave@xxxxxxxxxxxxxxxxxx>
> > + 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.

It's actually perilously close to free_pages_exact(). I'll try to make
it usable for this case as well.

-- Dave

--
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/