[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAE9FiQW3G3ncyVHV=0nbhX2cD2sLXTzn6FAprfa3y8AeMbE43A@mail.gmail.com>
Date: Mon, 15 Apr 2013 14:24:33 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Wang YanQing <udknight@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Yinghai Lu <yinghai@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] mm:memblock: add memblock_alloc_in_[range|range_nid]
On Mon, Apr 15, 2013 at 1:08 AM, Wang YanQing <udknight@...il.com> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists