lkml.org 
[lkml]   [2011]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch] x86, mm: Fix size of numa_distance array
    Hello,

    On Thu, Feb 24, 2011 at 03:31:24PM -0800, David Rientjes wrote:
    > > - size = ++cnt * sizeof(numa_distance[0]);
    > > + size = cnt * cnt * sizeof(numa_distance[0]);
    > >
    > > phys = memblock_find_in_range(0, (u64)max_pfn_mapped << PAGE_SHIFT,
    > > size, PAGE_SIZE);
    > >
    >
    > This also looks like it needs the following to not erroneously consider a
    > node id to be out of bounds. Why were we oversizing cnt in the old code
    > above by 1?

    Umm... because @cnt should be length not the last index?

    > diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
    > --- a/arch/x86/mm/numa_64.c
    > +++ b/arch/x86/mm/numa_64.c
    > @@ -454,7 +454,7 @@ void __init numa_set_distance(int from, int to, int distance)
    > if (!numa_distance && numa_alloc_distance() < 0)
    > return;
    >
    > - if (from >= numa_distance_cnt || to >= numa_distance_cnt) {
    > + if (from > numa_distance_cnt || to > numa_distance_cnt) {
    > printk_once(KERN_DEBUG "NUMA: Debug: distance out of bound, from=%d to=%d distance=%d\n",
    > from, to, distance);
    > return;
    > @@ -472,7 +472,7 @@ void __init numa_set_distance(int from, int to, int distance)
    >
    > int __node_distance(int from, int to)
    > {
    > - if (from >= numa_distance_cnt || to >= numa_distance_cnt)
    > + if (from > numa_distance_cnt || to > numa_distance_cnt)

    Again, numa_distance_cnt is the number of elements in one dimension of
    the table not the index, while @from and @to are 0 based index.

    Thanks.

    --
    tejun


    \
     
     \ /
      Last update: 2011-02-25 10:07    [W:0.022 / U:60.588 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site