Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1330223

Re: [PATCH v3] x86/setup: get ramdisk parameters only once

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3] x86/setup: get ramdisk parameters only once
Date 2016-02-09 14:20 +0100
Message-ID <r0gn0-4x9-17@gated-at.bofh.it> (permalink)
References <r0g3F-48r-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3] x86/setup: get ramdisk parameters only once Alexander Kuleshov <kuleshovmail@gmail.com> - 2016-02-09 14:00 +0100
  Re: [PATCH v3] x86/setup: get ramdisk parameters only once Ingo Molnar <mingo@kernel.org> - 2016-02-09 14:20 +0100
  Re: [PATCH v3] x86/setup: get ramdisk parameters only once kbuild test robot <lkp@intel.com> - 2016-02-09 14:30 +0100

csiph-web