Re: [PATCH] Add alloc_pages_exact() and free_pages_exact()

From: Timur Tabi
Date: Tue Jun 24 2008 - 18:00:11 EST


Dave Hansen wrote:

> This looks like a really good idea. It looks pretty good to me, no
> functional problems.

Thanks.

> I think the thing that confused me was trying to figure out if
> 'alloc_end' was the end of what we *did* allocate from
> __get_free_pages() or if it was the *goal* allocation end.
>
> 'used' also seemed like a slightly strange variable name because it
> points to the memory which is about to be freed and ends up *unused*.

This function is taken almost verbatim from alloc_large_system_hash(). I
figured if the terminology was good for that function, it's good for mine.

> I'll offer this up just in case you like it better. For me, it is
> easier to parse, and should do the exact same thing. I also think it's
> slightly nicer to do the arithmetic on 'struct page *' rather than
> vaddrs in 'unsigned long'. It is _slightly_ cheaper not having to do a
> virt_to_page() on each free_page() call. The same would go for the free
> side as well.

It does seem to be an improvement, although AKPM just accepted this patch. I'd
hate to bother him with a replacement patch for something so minor.

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