linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
@ 2019-01-29 15:12 Masayoshi Mizuma
  2019-01-29 16:16 ` Joe Lawrence
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Masayoshi Mizuma @ 2019-01-29 15:12 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, linux-kernel
  Cc: Masayoshi Mizuma, Hidetoshi Seto, Joe Lawrence

From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>

register_sched_domain_sysctl() copies the cpu_possible_mask into
sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been
allocated (ie, CONFIG_CPUMASK_OFFSTACK is set).  However, when
CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized
(all zeroes) and the kernel may fail to initialize sched_domain sysctl
entries for all possible cpus.

This is visible to the user if the kernel is booted with maxcpus=n, or
if ACPI tables have been modified to leave cpus offline, and then
checking for missing /proc/sys/kernel/sched_domain/cpu* entries.

Fix this by separating the allocataion and initialization, and adding
a flag to initialize the possible cpu entries while system booting only.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Tested-by: Syuuichirou Ishii <ishii.shuuichir@jp.fujitsu.com>
Tested-by: Tarumizu, Kohei <tarumizu.kohei@jp.fujitsu.com>
---
 kernel/sched/debug.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index de3de997e245..9c6637f3e21d 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -310,6 +310,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu)
 
 static cpumask_var_t		sd_sysctl_cpus;
 static struct ctl_table_header	*sd_sysctl_header;
+static int register_sched_domain_sysctl_on_boot = 1;
 
 void register_sched_domain_sysctl(void)
 {
@@ -344,9 +345,12 @@ void register_sched_domain_sysctl(void)
 	if (!cpumask_available(sd_sysctl_cpus)) {
 		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
 			return;
+	}
 
+	if (register_sched_domain_sysctl_on_boot) {
 		/* init to possible to not have holes in @cpu_entries */
 		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
+		register_sched_domain_sysctl_on_boot = 0;
 	}
 
 	for_each_cpu(i, sd_sysctl_cpus) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
  2019-01-29 15:12 [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK Masayoshi Mizuma
@ 2019-01-29 16:16 ` Joe Lawrence
  2019-01-30 20:14 ` Peter Zijlstra
  2019-02-04  9:02 ` [tip:sched/core] sched/debug: Initialize " tip-bot for Hidetoshi Seto
  2 siblings, 0 replies; 6+ messages in thread
From: Joe Lawrence @ 2019-01-29 16:16 UTC (permalink / raw)
  To: Masayoshi Mizuma, Ingo Molnar, Peter Zijlstra, linux-kernel
  Cc: Hidetoshi Seto

On 01/29/2019 10:12 AM, Masayoshi Mizuma wrote:
> From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> 
> register_sched_domain_sysctl() copies the cpu_possible_mask into
> sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been
> allocated (ie, CONFIG_CPUMASK_OFFSTACK is set).  However, when
> CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized
> (all zeroes) and the kernel may fail to initialize sched_domain sysctl
> entries for all possible cpus.
> 
> This is visible to the user if the kernel is booted with maxcpus=n, or
> if ACPI tables have been modified to leave cpus offline, and then
> checking for missing /proc/sys/kernel/sched_domain/cpu* entries.
> 
> Fix this by separating the allocataion and initialization, and adding

nit: s/allocataion/allocation (perhaps maintainer can fixup?)

> a flag to initialize the possible cpu entries while system booting only.
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
> Tested-by: Syuuichirou Ishii <ishii.shuuichir@jp.fujitsu.com>
> Tested-by: Tarumizu, Kohei <tarumizu.kohei@jp.fujitsu.com>
> ---
>   kernel/sched/debug.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index de3de997e245..9c6637f3e21d 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -310,6 +310,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu)
>   
>   static cpumask_var_t		sd_sysctl_cpus;
>   static struct ctl_table_header	*sd_sysctl_header;
> +static int register_sched_domain_sysctl_on_boot = 1;
>   
>   void register_sched_domain_sysctl(void)
>   {
> @@ -344,9 +345,12 @@ void register_sched_domain_sysctl(void)
>   	if (!cpumask_available(sd_sysctl_cpus)) {
>   		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
>   			return;
> +	}
>   
> +	if (register_sched_domain_sysctl_on_boot) {
>   		/* init to possible to not have holes in @cpu_entries */
>   		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
> +		register_sched_domain_sysctl_on_boot = 0;
>   	}
>   
>   	for_each_cpu(i, sd_sysctl_cpus) {
> 

Thanks for posting ... looks good on aarch64 where the issue mentioned 
in the commit message was reported.

Acked-by: Joe Lawrence <joe.lawrence@redhat.com>

-- Joe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
  2019-01-29 15:12 [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK Masayoshi Mizuma
  2019-01-29 16:16 ` Joe Lawrence
@ 2019-01-30 20:14 ` Peter Zijlstra
  2019-01-31 13:44   ` Masayoshi Mizuma
  2019-02-04  9:02 ` [tip:sched/core] sched/debug: Initialize " tip-bot for Hidetoshi Seto
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2019-01-30 20:14 UTC (permalink / raw)
  To: Masayoshi Mizuma; +Cc: Ingo Molnar, linux-kernel, Hidetoshi Seto, Joe Lawrence

On Tue, Jan 29, 2019 at 10:12:45AM -0500, Masayoshi Mizuma wrote:
> From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> 
> register_sched_domain_sysctl() copies the cpu_possible_mask into
> sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been
> allocated (ie, CONFIG_CPUMASK_OFFSTACK is set).  However, when
> CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized
> (all zeroes) and the kernel may fail to initialize sched_domain sysctl
> entries for all possible cpus.
> 
> This is visible to the user if the kernel is booted with maxcpus=n, or
> if ACPI tables have been modified to leave cpus offline, and then
> checking for missing /proc/sys/kernel/sched_domain/cpu* entries.
> 
> Fix this by separating the allocataion and initialization, and adding
> a flag to initialize the possible cpu entries while system booting only.
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
> Tested-by: Syuuichirou Ishii <ishii.shuuichir@jp.fujitsu.com>
> Tested-by: Tarumizu, Kohei <tarumizu.kohei@jp.fujitsu.com>
> ---
>  kernel/sched/debug.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index de3de997e245..9c6637f3e21d 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -310,6 +310,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu)
>  
>  static cpumask_var_t		sd_sysctl_cpus;
>  static struct ctl_table_header	*sd_sysctl_header;
> +static int register_sched_domain_sysctl_on_boot = 1;
>  
>  void register_sched_domain_sysctl(void)
>  {
> @@ -344,9 +345,12 @@ void register_sched_domain_sysctl(void)
>  	if (!cpumask_available(sd_sysctl_cpus)) {
>  		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
>  			return;
> +	}
>  
> +	if (register_sched_domain_sysctl_on_boot) {
>  		/* init to possible to not have holes in @cpu_entries */
>  		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
> +		register_sched_domain_sysctl_on_boot = 0;
>  	}
>  
>  	for_each_cpu(i, sd_sysctl_cpus) {

I change it like the below. By keeping the initial value 0 it can go
into .bss instead of .data.

--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -315,6 +315,7 @@ void register_sched_domain_sysctl(void)
 {
 	static struct ctl_table *cpu_entries;
 	static struct ctl_table **cpu_idx;
+	static bool init_done = false;
 	char buf[32];
 	int i;
 
@@ -344,7 +345,10 @@ void register_sched_domain_sysctl(void)
 	if (!cpumask_available(sd_sysctl_cpus)) {
 		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
 			return;
+	}
 
+	if (!init_done) {
+		init_done = true;
 		/* init to possible to not have holes in @cpu_entries */
 		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
 	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
  2019-01-30 20:14 ` Peter Zijlstra
@ 2019-01-31 13:44   ` Masayoshi Mizuma
  2019-02-01 22:33     ` Joe Lawrence
  0 siblings, 1 reply; 6+ messages in thread
From: Masayoshi Mizuma @ 2019-01-31 13:44 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, linux-kernel, Hidetoshi Seto, Joe Lawrence

On Wed, Jan 30, 2019 at 09:14:00PM +0100, Peter Zijlstra wrote:
> On Tue, Jan 29, 2019 at 10:12:45AM -0500, Masayoshi Mizuma wrote:
> > From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> > 
> > register_sched_domain_sysctl() copies the cpu_possible_mask into
> > sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been
> > allocated (ie, CONFIG_CPUMASK_OFFSTACK is set).  However, when
> > CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized
> > (all zeroes) and the kernel may fail to initialize sched_domain sysctl
> > entries for all possible cpus.
> > 
> > This is visible to the user if the kernel is booted with maxcpus=n, or
> > if ACPI tables have been modified to leave cpus offline, and then
> > checking for missing /proc/sys/kernel/sched_domain/cpu* entries.
> > 
> > Fix this by separating the allocataion and initialization, and adding
> > a flag to initialize the possible cpu entries while system booting only.
> > 
> > Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> > Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
> > Tested-by: Syuuichirou Ishii <ishii.shuuichir@jp.fujitsu.com>
> > Tested-by: Tarumizu, Kohei <tarumizu.kohei@jp.fujitsu.com>
> > ---
> >  kernel/sched/debug.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> > index de3de997e245..9c6637f3e21d 100644
> > --- a/kernel/sched/debug.c
> > +++ b/kernel/sched/debug.c
> > @@ -310,6 +310,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu)
> >  
> >  static cpumask_var_t		sd_sysctl_cpus;
> >  static struct ctl_table_header	*sd_sysctl_header;
> > +static int register_sched_domain_sysctl_on_boot = 1;
> >  
> >  void register_sched_domain_sysctl(void)
> >  {
> > @@ -344,9 +345,12 @@ void register_sched_domain_sysctl(void)
> >  	if (!cpumask_available(sd_sysctl_cpus)) {
> >  		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
> >  			return;
> > +	}
> >  
> > +	if (register_sched_domain_sysctl_on_boot) {
> >  		/* init to possible to not have holes in @cpu_entries */
> >  		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
> > +		register_sched_domain_sysctl_on_boot = 0;
> >  	}
> >  
> >  	for_each_cpu(i, sd_sysctl_cpus) {
> 
> I change it like the below. By keeping the initial value 0 it can go
> into .bss instead of .data.

Great, thanks!
Should I re-post the patch as v2?

- Masa

> 
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -315,6 +315,7 @@ void register_sched_domain_sysctl(void)
>  {
>  	static struct ctl_table *cpu_entries;
>  	static struct ctl_table **cpu_idx;
> +	static bool init_done = false;
>  	char buf[32];
>  	int i;
>  
> @@ -344,7 +345,10 @@ void register_sched_domain_sysctl(void)
>  	if (!cpumask_available(sd_sysctl_cpus)) {
>  		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
>  			return;
> +	}
>  
> +	if (!init_done) {
> +		init_done = true;
>  		/* init to possible to not have holes in @cpu_entries */
>  		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
>  	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
  2019-01-31 13:44   ` Masayoshi Mizuma
@ 2019-02-01 22:33     ` Joe Lawrence
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Lawrence @ 2019-02-01 22:33 UTC (permalink / raw)
  To: Masayoshi Mizuma, Peter Zijlstra
  Cc: Ingo Molnar, linux-kernel, Hidetoshi Seto

On 1/31/19 8:44 AM, Masayoshi Mizuma wrote:
> On Wed, Jan 30, 2019 at 09:14:00PM +0100, Peter Zijlstra wrote:
>> On Tue, Jan 29, 2019 at 10:12:45AM -0500, Masayoshi Mizuma wrote:
>>> From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
>>>
>>> register_sched_domain_sysctl() copies the cpu_possible_mask into
>>> sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been
>>> allocated (ie, CONFIG_CPUMASK_OFFSTACK is set).  However, when
>>> CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized
>>> (all zeroes) and the kernel may fail to initialize sched_domain sysctl
>>> entries for all possible cpus.
>>>
>>> This is visible to the user if the kernel is booted with maxcpus=n, or
>>> if ACPI tables have been modified to leave cpus offline, and then
>>> checking for missing /proc/sys/kernel/sched_domain/cpu* entries.
>>>
>>> Fix this by separating the allocataion and initialization, and adding
>>> a flag to initialize the possible cpu entries while system booting only.
>>>
>>> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
>>> Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
>>> Tested-by: Syuuichirou Ishii <ishii.shuuichir@jp.fujitsu.com>
>>> Tested-by: Tarumizu, Kohei <tarumizu.kohei@jp.fujitsu.com>
>>> ---
>>>   kernel/sched/debug.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
>>> index de3de997e245..9c6637f3e21d 100644
>>> --- a/kernel/sched/debug.c
>>> +++ b/kernel/sched/debug.c
>>> @@ -310,6 +310,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu)
>>>   
>>>   static cpumask_var_t		sd_sysctl_cpus;
>>>   static struct ctl_table_header	*sd_sysctl_header;
>>> +static int register_sched_domain_sysctl_on_boot = 1;
>>>   
>>>   void register_sched_domain_sysctl(void)
>>>   {
>>> @@ -344,9 +345,12 @@ void register_sched_domain_sysctl(void)
>>>   	if (!cpumask_available(sd_sysctl_cpus)) {
>>>   		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
>>>   			return;
>>> +	}
>>>   
>>> +	if (register_sched_domain_sysctl_on_boot) {
>>>   		/* init to possible to not have holes in @cpu_entries */
>>>   		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
>>> +		register_sched_domain_sysctl_on_boot = 0;
>>>   	}
>>>   
>>>   	for_each_cpu(i, sd_sysctl_cpus) {
>>
>> I change it like the below. By keeping the initial value 0 it can go
>> into .bss instead of .data.
> 
> Great, thanks!
> Should I re-post the patch as v2?
> 
> - Masa
> 

Peter's revision tests fine on my aarch64 box and would get my ACK, 
however it ends up getting re-posted :)

Thanks,

-- Joe

>>
>> --- a/kernel/sched/debug.c
>> +++ b/kernel/sched/debug.c
>> @@ -315,6 +315,7 @@ void register_sched_domain_sysctl(void)
>>   {
>>   	static struct ctl_table *cpu_entries;
>>   	static struct ctl_table **cpu_idx;
>> +	static bool init_done = false;
>>   	char buf[32];
>>   	int i;
>>   
>> @@ -344,7 +345,10 @@ void register_sched_domain_sysctl(void)
>>   	if (!cpumask_available(sd_sysctl_cpus)) {
>>   		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
>>   			return;
>> +	}
>>   
>> +	if (!init_done) {
>> +		init_done = true;
>>   		/* init to possible to not have holes in @cpu_entries */
>>   		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
>>   	}


-- Joe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:sched/core] sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
  2019-01-29 15:12 [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK Masayoshi Mizuma
  2019-01-29 16:16 ` Joe Lawrence
  2019-01-30 20:14 ` Peter Zijlstra
@ 2019-02-04  9:02 ` tip-bot for Hidetoshi Seto
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Hidetoshi Seto @ 2019-02-04  9:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: ishii.shuuichir, torvalds, seto.hidetoshi, tglx, joe.lawrence,
	peterz, tarumizu.kohei, mingo, m.mizuma, efault, linux-kernel,
	msys.mizuma, hpa

Commit-ID:  1ca4fa3ab604734e38e2a3000c9abf788512ffa7
Gitweb:     https://git.kernel.org/tip/1ca4fa3ab604734e38e2a3000c9abf788512ffa7
Author:     Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
AuthorDate: Tue, 29 Jan 2019 10:12:45 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 4 Feb 2019 09:13:21 +0100

sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK

register_sched_domain_sysctl() copies the cpu_possible_mask into
sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been
allocated (ie, CONFIG_CPUMASK_OFFSTACK is set).  However, when
CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left
uninitialized (all zeroes) and the kernel may fail to initialize
sched_domain sysctl entries for all possible CPUs.

This is visible to the user if the kernel is booted with maxcpus=n, or
if ACPI tables have been modified to leave CPUs offline, and then
checking for missing /proc/sys/kernel/sched_domain/cpu* entries.

Fix this by separating the allocation and initialization, and adding a
flag to initialize the possible CPU entries while system booting only.

Tested-by: Syuuichirou Ishii <ishii.shuuichir@jp.fujitsu.com>
Tested-by: Tarumizu, Kohei <tarumizu.kohei@jp.fujitsu.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190129151245.5073-1-msys.mizuma@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/debug.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index de3de997e245..8039d62ae36e 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -315,6 +315,7 @@ void register_sched_domain_sysctl(void)
 {
 	static struct ctl_table *cpu_entries;
 	static struct ctl_table **cpu_idx;
+	static bool init_done = false;
 	char buf[32];
 	int i;
 
@@ -344,7 +345,10 @@ void register_sched_domain_sysctl(void)
 	if (!cpumask_available(sd_sysctl_cpus)) {
 		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
 			return;
+	}
 
+	if (!init_done) {
+		init_done = true;
 		/* init to possible to not have holes in @cpu_entries */
 		cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
 	}

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-04  9:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 15:12 [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK Masayoshi Mizuma
2019-01-29 16:16 ` Joe Lawrence
2019-01-30 20:14 ` Peter Zijlstra
2019-01-31 13:44   ` Masayoshi Mizuma
2019-02-01 22:33     ` Joe Lawrence
2019-02-04  9:02 ` [tip:sched/core] sched/debug: Initialize " tip-bot for Hidetoshi Seto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).