Re: [PATCH x86/mm UPDATED] x86-64, NUMA: Fix distance table handling

From: Yinghai Lu
Date: Wed Mar 02 2011 - 11:47:18 EST


On 03/02/2011 08:37 AM, Tejun Heo wrote:
> Hey, Yinghai.
>
> On Wed, Mar 02, 2011 at 08:16:18AM -0800, Yinghai Lu wrote:
>> my original part:
>>
>> @@ -393,7 +393,7 @@ void __init numa_reset_distance(void)
>> size_t size;
>>
>> if (numa_distance_cnt) {
>> - size = numa_distance_cnt * sizeof(numa_distance[0]);
>> + size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]);
>> memblock_x86_free_range(__pa(numa_distance),
>> __pa(numa_distance) + size);
>> numa_distance_cnt = 0;
>>
>> So can you tell me why you need to make those change?
>> move out assigning or numa_distance_cnt and size of the the IF
>
> Please read the patch description. I actually wrote that down. :-)

well you said:
> while at it, take numa_distance_cnt resetting in
> numa_reset_distance() out of the if block to simplify the code a bit.

what are you talking about? what do you mean "simplify the code a bit" ?

>
>> the change include:
>> 1. you only need to go over new_nr*new_nr instead huge MAX_NUMNODES * MAX_NUMNODES
>> 2. you do NOT need to go over it if you don't have phys_dist assigned before.
>> numa_alloc_distance already have that default set.
>> 3. do need to check if phys_dist is assigned before referring phys_dist.
>
> * If you wanted to make that change, split it into a separate patch.
> Don't mix it with changes which actually fix the bug.
>
> * I don't think it's gonna matter all that much. It's one time and
> only used if emulation is enabled, but then again yeap MAX_NUMNODES
> * MAX_NUMNODES can get quite high, but it looks way too complicated
> for what it achieves. Just looping over enabled nodes should
> achieve about the same thing in much simpler way, right?

what kind of excuse to put inefficiency code there!

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/