Re: [RFC PATCH -v3 1/2] lmb: seperate region array from lmb_region struct

Yinghai Lu
2010-03-23T17:19:26Z

On 03/23/2010 06:18 AM, Paul Mundt wrote:
> On Tue, Mar 23, 2010 at 11:42:41AM +0100, Ingo Molnar wrote:
>>
>> * Yinghai Lu <yinghai@kernel.org> wrote:
>>
>>> void __init lmb_init(void)
>>> {
>>> + lmb.memory.region = lmb_memory_region;
>>> + lmb.memory.region_array_size = ARRAY_SIZE(lmb_memory_region);
>>> + lmb.reserved.region = lmb_reserved_region;
>>> + lmb.reserved.region_array_size = ARRAY_SIZE(lmb_reserved_region);
>>> +
>>
>> That's rather unreadable and has random whitespace noise.
>>
>> Should be something like:
>>
>> lmb.memory.region = lmb_memory_region;
>> lmb.memory.region_array_size = ARRAY_SIZE(lmb_memory_region);
>> lmb.reserved.region = lmb_reserved_region;
>> lmb.reserved.region_array_size = ARRAY_SIZE(lmb_reserved_region);
>>
>> also, i'd suggest to shorten region_array_size to region_size (we know it's an
>> array), so it would become:
>>
>> lmb.memory.region = lmb_memory_region;
>> lmb.memory.region_size = ARRAY_SIZE(lmb_memory_region);
>>
> I don't mean to be pedantic, but the LMB code already has a lot of
> region.size references so region_size looks a bit awkward. All of the
> accessors in linux/lmb.h use region_nr as the array index, so perhaps
> nr_regions would be less ambiguous.

@@ -26,7 +26,8 @@ struct lmb_property {
struct lmb_region {
unsigned long cnt;
u64 size;
- struct lmb_property region[MAX_LMB_REGIONS+1];
+ struct lmb_property *region;
+ unsigned long region_array_size;
};

cnt is number of slots used.
size is memory size

can we use rgn_sz for region array size?

YH