lkml.org 
[lkml]   [2011]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 1/2] x86, numa, emu: move size calculation into if block


    don't need to assign them that early.

    Signed-off-by: Yinghai Lu <yinghai@kernel.org>
    ---
    arch/x86/mm/numa_64.c | 11 +++++------
    arch/x86/mm/numa_emulation.c | 3 ++-
    2 files changed, 7 insertions(+), 7 deletions(-)

    Index: linux-2.6/arch/x86/mm/numa_64.c
    ===================================================================
    --- linux-2.6.orig/arch/x86/mm/numa_64.c
    +++ linux-2.6/arch/x86/mm/numa_64.c
    @@ -390,13 +390,12 @@ static void __init numa_nodemask_from_me
    */
    void __init numa_reset_distance(void)
    {
    - size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]);
    -
    /* numa_distance could be 1LU marking allocation failure, test cnt */
    - if (numa_distance_cnt)
    - memblock_x86_free_range(__pa(numa_distance),
    - __pa(numa_distance) + size);
    - numa_distance_cnt = 0;
    + if (numa_distance_cnt) {
    + size_t 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;
    + }
    numa_distance = NULL; /* enable table creation */
    }

    Index: linux-2.6/arch/x86/mm/numa_emulation.c
    ===================================================================
    --- linux-2.6.orig/arch/x86/mm/numa_emulation.c
    +++ linux-2.6/arch/x86/mm/numa_emulation.c
    @@ -300,7 +300,7 @@ void __init numa_emulation(struct numa_m
    static struct numa_meminfo pi __initdata;
    const u64 max_addr = max_pfn << PAGE_SHIFT;
    u8 *phys_dist = NULL;
    - size_t phys_size = numa_dist_cnt * numa_dist_cnt * sizeof(phys_dist[0]);
    + size_t phys_size = 0;
    int i, j, ret;

    if (!emu_cmdline)
    @@ -341,6 +341,7 @@ void __init numa_emulation(struct numa_m
    if (numa_dist_cnt) {
    u64 phys;

    + phys_size = numa_dist_cnt * numa_dist_cnt * sizeof(phys_dist[0]);
    phys = memblock_find_in_range(0,
    (u64)max_pfn_mapped << PAGE_SHIFT,
    phys_size, PAGE_SIZE);

    \
     
     \ /
      Last update: 2011-03-03 02:27    [W:0.020 / U:1.652 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site