[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52A0E357.7090008@ti.com>
Date: Thu, 5 Dec 2013 15:34:31 -0500
From: Santosh Shilimkar <santosh.shilimkar@...com>
To: "Strashko, Grygorii" <grygorii.strashko@...com>
CC: Tejun Heo <tj@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Yinghai Lu <yinghai@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2 08/23] mm/memblock: Add memblock memory allocation
apis
Grygorii,
On Thursday 05 December 2013 01:48 PM, Strashko, Grygorii wrote:
> Hi Tejun,
>
>> On Thu, Dec 05, 2013 at 06:35:00PM +0200, Grygorii Strashko wrote:
>>>>> +#define memblock_virt_alloc_align(x, align) \
>>>>> + memblock_virt_alloc_try_nid(x, align, BOOTMEM_LOW_LIMIT, \
>>>>> + BOOTMEM_ALLOC_ACCESSIBLE, MAX_NUMNODES)
>>>>
>>>> Also, do we really need this align variant separate when the caller
>>>> can simply specify 0 for the default?
>>>
>>> Unfortunately Yes.
>>> We need it to keep compatibility with bootmem/nobootmem
>>> which don't handle 0 as default align value.
>>
>> Hmm... why wouldn't just interpreting 0 to SMP_CACHE_BYTES in the
>> memblock_virt*() function work?
>>
>
> Problem is not with memblock_virt*(). The issue will happen in case if
> memblock or nobootmem are disabled in below code (memblock_virt*() is disabled).
>
> +/* Fall back to all the existing bootmem APIs */
> +#define memblock_virt_alloc(x) \
> + __alloc_bootmem(x, SMP_CACHE_BYTES, BOOTMEM_LOW_LIMIT)
>
> which will be transformed to
> +/* Fall back to all the existing bootmem APIs */
> +#define memblock_virt_alloc(x, align) \
> + __alloc_bootmem(x, align, BOOTMEM_LOW_LIMIT)
>
> and used as
>
> memblock_virt_alloc(size, 0);
>
> so, by default bootmem code will use 0 as default alignment and not SMP_CACHE_BYTES
> and that is wrong.
>
Looks like you didn't understood the suggestion completely.
The fall back inline will look like below .....
static inline memblock_virt_alloc(x, align)
{
if (align == 0)
align = SMP_CACHE_BYTES
__alloc_bootmem(x, align, BOOTMEM_LOW_LIMIT);
}
regards,
Santosh
--
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