init: Remove permanent string buffer from do_one_initcall()

From: Steven Rostedt
Date: Wed May 01 2013 - 15:00:50 EST


[
Linus, I noticed the permanent string when doing the other patch
and thought we could use a clean up and place it on the stack.
It's only 64 bytes, and the function is called in limited scope.
It's just a small amount, but why keep that memory wasted.

Feel free to add it for 3.10, or perhaps Andrew can pull it
into -mm for 3.11. This is just a clean up anyway.
]

do_one_initcall() uses a 64 byte string buffer to save a message. This
buffer is declared static and is only used at boot up and when a module
is loaded. As 64 bytes is very small, and this function has very limited
scope, there's no reason to waste permanent memory with this string and
not just simply put it on the stack.

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

diff --git a/init/main.c b/init/main.c
index bea1287..d1f1e31 100644
--- a/init/main.c
+++ b/init/main.c
@@ -654,8 +654,6 @@ static void __init do_ctors(void)
bool initcall_debug;
core_param(initcall_debug, initcall_debug, bool, 0644);

-static char msgbuf[64];
-
static int __init_or_module do_one_initcall_debug(initcall_t fn)
{
ktime_t calltime, delta, rettime;
@@ -678,6 +676,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
{
int count = preempt_count();
int ret;
+ char msgbuf[64];

if (initcall_debug)
ret = do_one_initcall_debug(fn);


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