[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160217082555.GA1197@gmail.com>
Date: Wed, 17 Feb 2016 09:25:55 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Alexander Kuleshov <kuleshovmail@...il.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Borislav Petkov <bp@...e.de>, Joerg Roedel <jroedel@...e.de>,
Dave Young <dyoung@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jiri Kosina <jkosina@...e.cz>, Baoquan He <bhe@...hat.com>,
Mark Salter <msalter@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] x86/setup: get ramdisk parameters only once
* Alexander Kuleshov <kuleshovmail@...il.com> wrote:
> void __init setup_arch(char **cmdline_p)
> {
> + struct ramdisk ramdisk_image = {
> + .start_addr = get_ramdisk_image(),
> + .size = get_ramdisk_size(),
> + .reserve_ramdisk = true
> + };
> +
> + /* Assume only end is not page aligned */
> + ramdisk_image.end_addr = PAGE_ALIGN(ramdisk_image.start_addr + ramdisk_image.size),
> +
> memblock_reserve(__pa_symbol(_text),
> (unsigned long)__bss_stop - (unsigned long)_text);
>
> - early_reserve_initrd();
> + if (!boot_params.hdr.type_of_loader || !ramdisk_image.start_addr
> + || !ramdisk_image.size)
Don't do pointless line breaks.
> + ramdisk_image.reserve_ramdisk = false; /* No initrd provided by bootloader */
> + else
> + memblock_reserve(ramdisk_image.start_addr,
> + ramdisk_image.end_addr - ramdisk_image.start_addr);
There's a simpler way to write that line ...
> /*
> * At this point everything still needed from the boot loader
> @@ -1135,7 +1137,8 @@ void __init setup_arch(char **cmdline_p)
> /* Allocate bigger log buffer */
> setup_log_buf(1);
>
> - reserve_initrd();
> + if (ramdisk_image.reserve_ramdisk)
> + reserve_initrd(&ramdisk_image);
It's cleaner to make that check inside reserve_initrd() ...
Thanks,
Ingo
Powered by blists - more mailing lists