From: Ingo Molnar <mingo@kernel.org>
To: Alexander Kuleshov <kuleshovmail@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@suse.de>,
Joerg Roedel <jroedel@suse.de>, Dave Young <dyoung@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Kosina <jkosina@suse.cz>, Baoquan He <bhe@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Mark Salter <msalter@redhat.com>,
linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v3] x86/setup: get ramdisk parameters only once
Date: Tue, 9 Feb 2016 14:13:26 +0100 [thread overview]
Message-ID: <20160209131326.GA21762@gmail.com> (raw)
In-Reply-To: <1455022488-1519-1-git-send-email-kuleshovmail@gmail.com>
* Alexander Kuleshov <kuleshovmail@gmail.com> wrote:
> +/*
> + * ramdisk setup
> + */
> +struct ramdisk {
> + u64 image;
> + u64 size;
> + u64 end;
> +};
So what exactly are 'image' and 'end'? The names are not self-descriptory. Please
add comments that describe them and use the opportunity to rename the fields to
more self-descriptory names.
> +static void __init relocate_initrd(struct ramdisk ramdisk)
Why pass by value, why not by address?
> {
> + u64 area_size = PAGE_ALIGN(ramdisk.size);
Why introduce a local variable here? Also, isn't ramdisk.size already page
aligned?
> +static void __init early_reserve_initrd(struct ramdisk ramdisk)
> {
> + memblock_reserve(ramdisk.image, ramdisk.end - ramdisk.image);
> }
Looks like a pretty pointless function now - can be expanded into its call site.
> void __init setup_arch(char **cmdline_p)
> {
> + struct ramdisk ramdisk_image = {
> + .image = get_ramdisk_image(),
> + .size = get_ramdisk_size(),
> + /* Assume only end is not page aligned */
> + .end = PAGE_ALIGN(ramdisk_image.image + ramdisk_image.size)
> + };
> + bool reserve_ramdisk = true;
Why not merge 'reserve_ramdisk' into the ramdisk state structure as well?
> - early_reserve_initrd();
> + if (!boot_params.hdr.type_of_loader || !ramdisk_image.image
> + || !ramdisk_image.size) {
> + reserve_ramdisk = false;
> + return; /* No initrd provided by bootloader */
> + } else
> + early_reserve_initrd(ramdisk_image);
Curly braces should be balanced.
Thanks,
Ingo
next prev parent reply other threads:[~2016-02-09 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 12:54 Alexander Kuleshov
2016-02-09 13:13 ` Ingo Molnar [this message]
2016-02-09 13:22 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160209131326.GA21762@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=bp@suse.de \
--cc=dyoung@redhat.com \
--cc=hpa@zytor.com \
--cc=jkosina@suse.cz \
--cc=jroedel@suse.de \
--cc=kuleshovmail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=msalter@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®