Commit ad1cdc1d authored by Milton Miller's avatar Milton Miller Committed by Ingo Molnar

sched: domain sysctl fixes: do not crash on allocation failure

Now that we are calling this at runtime, a more relaxed error path is
suggested.  If an allocation fails, we just register the partial table,
which will show empty directories.
Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 6382bc90
...@@ -5245,8 +5245,6 @@ static struct ctl_table *sd_alloc_ctl_entry(int n) ...@@ -5245,8 +5245,6 @@ static struct ctl_table *sd_alloc_ctl_entry(int n)
struct ctl_table *entry = struct ctl_table *entry =
kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL); kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL);
BUG_ON(!entry);
return entry; return entry;
} }
...@@ -5279,6 +5277,9 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd) ...@@ -5279,6 +5277,9 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
{ {
struct ctl_table *table = sd_alloc_ctl_entry(12); struct ctl_table *table = sd_alloc_ctl_entry(12);
if (table == NULL)
return NULL;
set_table_entry(&table[0], "min_interval", &sd->min_interval, set_table_entry(&table[0], "min_interval", &sd->min_interval,
sizeof(long), 0644, proc_doulongvec_minmax); sizeof(long), 0644, proc_doulongvec_minmax);
set_table_entry(&table[1], "max_interval", &sd->max_interval, set_table_entry(&table[1], "max_interval", &sd->max_interval,
...@@ -5316,6 +5317,8 @@ static ctl_table *sd_alloc_ctl_cpu_table(int cpu) ...@@ -5316,6 +5317,8 @@ static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
for_each_domain(cpu, sd) for_each_domain(cpu, sd)
domain_num++; domain_num++;
entry = table = sd_alloc_ctl_entry(domain_num + 1); entry = table = sd_alloc_ctl_entry(domain_num + 1);
if (table == NULL)
return NULL;
i = 0; i = 0;
for_each_domain(cpu, sd) { for_each_domain(cpu, sd) {
...@@ -5336,6 +5339,9 @@ static void register_sched_domain_sysctl(void) ...@@ -5336,6 +5339,9 @@ static void register_sched_domain_sysctl(void)
struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1); struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
char buf[32]; char buf[32];
if (entry == NULL)
return;
sd_ctl_dir[0].child = entry; sd_ctl_dir[0].child = entry;
for_each_online_cpu(i) { for_each_online_cpu(i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment