lkml.org 
[lkml]   [2010]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 18/39] lmb: Add lmb_reserve_area_overlap_ok()
On 04/12/2010 09:21 PM, Benjamin Herrenschmidt wrote:
> On Thu, 2010-04-08 at 23:03 -0700, Yinghai Lu wrote:
>> Some areas from firmware could be reserved several times from different callers.
>>
>> If these area are overlapped, We may have overlapped entries in lmb.reserved.
>>
>> Try to free the area at first, before rerserve them again.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>> ---
>
>> +
>> +/*
>> + * Could be used to avoid having overlap entries in lmb.reserved.region.
>> + * Don't need to use it with area that is from lmb_find_area()
>> + * Only use it for the area that fw hidden area.
>> + */
>> +void __init lmb_reserve_area_overlap_ok(u64 start, u64 end, char *name)
>> +{
>> + if (start == end)
>> + return;
>> +
>> + if (WARN_ONCE(start > end, "lmb_reserve_area_overlap_ok: wrong range [%#llx, %#llx]\n", start, end))
>> + return;
>> +
>> + /* Free that region at first */
>> + lmb_free(start, end - start);
>> + __lmb_reserve_area(start, end, name);
>> }
>
> That is going to only work with one overlap. IE. lmb_free() will not do
> very well unless it's a one and only match.
>
> You should modify it to work in a loop.
that is only for some special cases about area that is reserved for fw region.

and even there is overlapped area, it the code still can go through when lmb_to_bootmem or create range list for slab.
because they are using range array subtract.

>
> Besides, lmb_reserve_area_overlap_ok() sucks as a name :-)

any suggestion for better name?

YH


\
 
 \ /
  Last update: 2010-04-13 06:51    [W:0.190 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site