Re: [PATCH] x86: cleanup reloated_initrd

From: Yinghai Lu
Date: Sat Jun 14 2008 - 18:09:28 EST


On Sat, Jun 14, 2008 at 12:39 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
> Yinghai Lu wrote:
> Signed-off-by: Yinghai Lu <yhlu.kernel@xxxxxxxxx>
>>>>
>>>> Index: linux-2.6/arch/x86/kernel/setup_32.c
>>>> ===================================================================
>>>> --- linux-2.6.orig/arch/x86/kernel/setup_32.c
>>>> +++ linux-2.6/arch/x86/kernel/setup_32.c
>>>> @@ -585,6 +585,9 @@ static void __init relocate_initrd(void)
>>>> printk(KERN_INFO "Copied RAMDISK from %016llx - %016llx to %08llx
>>>> -
>>>> %08llx\n",
>>>> ramdisk_image, ramdisk_image + ramdisk_size - 1,
>>>> ramdisk_here, ramdisk_here + ramdisk_size - 1);
>>>> +
>>>> + /* need to free that, otherwise init highmem will reserve it
>>>> again
>>>> */
>>>> + free_early(ramdisk_image, ramdisk_image+ramdisk_size);
>>>> }
>>>>
>>> I'm somewhat confused by this... you realize that the old location and
>>> the
>>> new location of the initrd will overlap, right?
>>
>> Ying Huang add page_is_reserved_early check in
>> add_one_highpage_init(), so reserve_early high address will be
>> reserved when in init high. that is not wanted old initrd in high
>> region we will lose some ram
>>
>
> Yes, but I think the above will free part of the active area if the areas
> overlap.

overlap parts below max_low_pfn is freed with free_bootmem

and free_early only remove that entry in early_res array. and at that
time, we already called
early_res_to_bootmem.

so it is safe.

YH
--
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/