Re: [PATCH 3/3] mm:memblock: add memblock_alloc_in_[range|range_nid]
From: Yinghai Lu
Date: Mon Apr 15 2013 - 17:24:40 EST
On Mon, Apr 15, 2013 at 1:08 AM, Wang YanQing <udknight@xxxxxxxxx> wrote:
> There is a memblock code use pattern in kernel which looks like below:
> in nobootmem.c:
>
> addr = memblock_find_in_range_node(goal, limit, size, align, nid);
> if (!addr)
> return NULL;
>
> ptr = phys_to_virt(addr);
> memset(ptr, 0, size);
> memblock_reserve(addr, size);
>
> use memblock_alloc_in_[range|range_nid] to do
> the search and reserve in one function will
> bring the benefit below:
>
> 1: clarify the codes
> 2: we will check memblock_reserve's return value
No, I don't like this.
It cause confusing.
alloc usually it means allocate and access it right away.
find/reserve, is somehow will only access some time later.
also in find/reserve path, we don't round size to align.
size = round_up(size, align);
Thanks
Yinghai
--
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/