diff mbox

[30/38] tick-sched: move nohz_full_buf[] inside tick_nohz_init()

Message ID b9bb3a40fc7a973438a54ddab8e1c89c6c66dd8c.1397492345.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar April 14, 2014, 4:23 p.m. UTC
nohz_full_buf[] is used at only one place, i.e. inside tick_nohz_init(). Make it
a local variable. Can move it out in case it is used in some other routines in
future.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/time/tick-sched.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Frederic Weisbecker April 14, 2014, 11:28 p.m. UTC | #1
On Mon, Apr 14, 2014 at 09:53:52PM +0530, Viresh Kumar wrote:
> nohz_full_buf[] is used at only one place, i.e. inside tick_nohz_init(). Make it
> a local variable. Can move it out in case it is used in some other routines in
> future.

OTOH nohz_full_buf can have a big size and moving it to a local variable
will result in big increase in kernel stack consumption.

Keeping it static is safer.

Also it's already __initdata so it's released after bootup. No issue of
concurrent use either, so keeping it as is is fine.

> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  kernel/time/tick-sched.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index d8b9a69..22b9505 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -321,13 +321,6 @@ static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
>  	return NOTIFY_OK;
>  }
>  
> -/*
> - * Worst case string length in chunks of CPU range seems 2 steps
> - * separations: 0,2,4,6,...
> - * This is NR_CPUS + sizeof('\0')
> - */
> -static char __initdata nohz_full_buf[NR_CPUS + 1];
> -
>  static int tick_nohz_init_all(void)
>  {
>  	int err = -1;
> @@ -347,6 +340,12 @@ static int tick_nohz_init_all(void)
>  
>  void __init tick_nohz_init(void)
>  {
> +	/*
> +	 * Worst case string length in chunks of CPU range seems 2 steps
> +	 * separations: 0,2,4,6,...
> +	 * This is NR_CPUS + sizeof('\0')
> +	 */
> +	char nohz_full_buf[NR_CPUS + 1];
>  	int cpu;
>  
>  	if (!tick_nohz_full_running) {
> -- 
> 1.7.12.rc2.18.g61b472e
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Viresh Kumar April 15, 2014, 4:01 a.m. UTC | #2
On 15 April 2014 04:58, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> OTOH nohz_full_buf can have a big size and moving it to a local variable
> will result in big increase in kernel stack consumption.
>
> Keeping it static is safer.
>
> Also it's already __initdata so it's released after bootup. No issue of
> concurrent use either, so keeping it as is is fine.

Okay, this patch is dropped.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index d8b9a69..22b9505 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -321,13 +321,6 @@  static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
 	return NOTIFY_OK;
 }
 
-/*
- * Worst case string length in chunks of CPU range seems 2 steps
- * separations: 0,2,4,6,...
- * This is NR_CPUS + sizeof('\0')
- */
-static char __initdata nohz_full_buf[NR_CPUS + 1];
-
 static int tick_nohz_init_all(void)
 {
 	int err = -1;
@@ -347,6 +340,12 @@  static int tick_nohz_init_all(void)
 
 void __init tick_nohz_init(void)
 {
+	/*
+	 * Worst case string length in chunks of CPU range seems 2 steps
+	 * separations: 0,2,4,6,...
+	 * This is NR_CPUS + sizeof('\0')
+	 */
+	char nohz_full_buf[NR_CPUS + 1];
 	int cpu;
 
 	if (!tick_nohz_full_running) {