aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2007-10-15 11:00:19 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:19 -0400
commitad1cdc1d7883e88f936f7888a092e4e3e6d8c631 (patch)
tree3ef43757e9355a31c61dd57b190f1790c5e3b49f /kernel
parent6382bc90f5664c450afc1f896e7ddb35ba182af9 (diff)
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: Milton Miller <miltonm@bga.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index a2dd05435534..f40fe027723f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5245,8 +5245,6 @@ static struct ctl_table *sd_alloc_ctl_entry(int n)
5245 struct ctl_table *entry = 5245 struct ctl_table *entry =
5246 kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL); 5246 kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL);
5247 5247
5248 BUG_ON(!entry);
5249
5250 return entry; 5248 return entry;
5251} 5249}
5252 5250
@@ -5279,6 +5277,9 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
5279{ 5277{
5280 struct ctl_table *table = sd_alloc_ctl_entry(12); 5278 struct ctl_table *table = sd_alloc_ctl_entry(12);
5281 5279
5280 if (table == NULL)
5281 return NULL;
5282
5282 set_table_entry(&table[0], "min_interval", &sd->min_interval, 5283 set_table_entry(&table[0], "min_interval", &sd->min_interval,
5283 sizeof(long), 0644, proc_doulongvec_minmax); 5284 sizeof(long), 0644, proc_doulongvec_minmax);
5284 set_table_entry(&table[1], "max_interval", &sd->max_interval, 5285 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 for_each_domain(cpu, sd) 5317 for_each_domain(cpu, sd)
5317 domain_num++; 5318 domain_num++;
5318 entry = table = sd_alloc_ctl_entry(domain_num + 1); 5319 entry = table = sd_alloc_ctl_entry(domain_num + 1);
5320 if (table == NULL)
5321 return NULL;
5319 5322
5320 i = 0; 5323 i = 0;
5321 for_each_domain(cpu, sd) { 5324 for_each_domain(cpu, sd) {
@@ -5336,6 +5339,9 @@ static void register_sched_domain_sysctl(void)
5336 struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1); 5339 struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
5337 char buf[32]; 5340 char buf[32];
5338 5341
5342 if (entry == NULL)
5343 return;
5344
5339 sd_ctl_dir[0].child = entry; 5345 sd_ctl_dir[0].child = entry;
5340 5346
5341 for_each_online_cpu(i) { 5347 for_each_online_cpu(i) {