From: Rusty Russell <rusty@rustcorp.com.au>
To: linux-kernel@vger.kernel.org
Subject: [RFC 8/8] params: don't use alloc_bootmem for saved_command_line
Date: Mon, 1 Dec 2008 23:26:59 +1030 [thread overview]
Message-ID: <200812012327.00134.rusty@rustcorp.com.au> (raw)
We only need it for /proc, so just use kstrdup().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
init/main.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/init/main.c b/init/main.c
--- a/init/main.c
+++ b/init/main.c
@@ -123,8 +123,6 @@ char __initdata boot_command_line[COMMAN
char __initdata boot_command_line[COMMAND_LINE_SIZE];
/* Untouched saved command line (eg. for /proc) */
char *saved_command_line;
-/* Command line for parameter parsing */
-static char *static_command_line;
static char *execute_command;
static char *ramdisk_execute_command;
@@ -453,20 +451,6 @@ static void __init smp_init(void)
#endif
/*
- * We need to store the untouched command line for future reference.
- * We also need to store the touched command line since the parameter
- * parsing is performed in place, and we should allow a component to
- * store reference of name/value for future reference.
- */
-static void __init setup_command_line(void)
-{
- saved_command_line = alloc_bootmem(strlen (boot_command_line)+1);
- static_command_line = alloc_bootmem(strlen (boot_command_line)+1);
- strcpy (saved_command_line, boot_command_line);
- strcpy (static_command_line, boot_command_line);
-}
-
-/*
* We need to finalize in a non-__init function or else race conditions
* between the root thread and the init thread may cause start_kernel to
* be reaped by free_initmem before the root thread has proceeded to
@@ -547,6 +531,8 @@ void __init __weak arch_get_boot_command
/* Ideally, this would take a 'const char *cmdline' param. */
asmlinkage void __init start_kernel(void)
{
+ char *static_command_line;
+
arch_get_boot_command_line();
parse_args("Core params", boot_command_line, __start___core_param,
__stop___core_param - __start___core_param,
@@ -582,7 +568,6 @@ asmlinkage void __init start_kernel(void
printk(linux_banner);
setup_arch();
mm_init_owner(&init_mm, &init_task);
- setup_command_line();
unwind_setup();
setup_per_cpu_areas();
@@ -603,6 +588,9 @@ asmlinkage void __init start_kernel(void
build_all_zonelists();
page_alloc_init();
printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
+ /* param parsing can keep pointers to the commandline. */
+ static_command_line = alloc_bootmem(strlen(boot_command_line)+1);
+ strcpy(static_command_line, boot_command_line);
parse_args("Booting kernel", static_command_line, __start___param,
__stop___param - __start___param,
&unknown_bootoption, false);
@@ -704,6 +692,8 @@ asmlinkage void __init start_kernel(void
ftrace_init();
+ saved_command_line = kstrdup(boot_command_line, GFP_KERNEL);
+
/* Do the rest non-__init'ed, we're now alive */
rest_init();
}
reply other threads:[~2008-12-01 12:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200812012327.00134.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.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