public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Milton Miller <miltonm@bga.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] sched domain sysctl: don't bug on alloc failure
Date: Fri, 12 Oct 2007 04:35:19 -0500 (CDT)	[thread overview]
Message-ID: <mm-sched-4@bga.com> (raw)
In-Reply-To: <mm-sched-0@bga.com>

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>

Index: kernel/kernel/sched.c
===================================================================
--- kernel.orig/kernel/sched.c	2007-10-12 03:59:02.000000000 -0500
+++ kernel/kernel/sched.c	2007-10-12 03:59:07.000000000 -0500
@@ -5285,8 +5285,6 @@ static struct ctl_table *sd_alloc_ctl_en
 	struct ctl_table *entry =
 		kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL);
 
-	BUG_ON(!entry);
-
 	return entry;
 }
 
@@ -5319,6 +5317,9 @@ sd_alloc_ctl_domain_table(struct sched_d
 {
 	struct ctl_table *table = sd_alloc_ctl_entry(14);
 
+	if (table == NULL)
+		return NULL;
+
 	set_table_entry(&table[0], "min_interval", &sd->min_interval,
 		sizeof(long), 0644, proc_doulongvec_minmax);
 	set_table_entry(&table[1], "max_interval", &sd->max_interval,
@@ -5356,6 +5357,8 @@ static ctl_table *sd_alloc_ctl_cpu_table
 	for_each_domain(cpu, sd)
 		domain_num++;
 	entry = table = sd_alloc_ctl_entry(domain_num + 1);
+	if (table == NULL)
+		return NULL;
 
 	i = 0;
 	for_each_domain(cpu, sd) {
@@ -5376,6 +5379,9 @@ static void register_sched_domain_sysctl
 	struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
 	char buf[32];
 
+	if (entry == NULL)
+		return;
+
 	sd_ctl_dir[0].child = entry;
 
 	for_each_online_cpu(i) {

  parent reply	other threads:[~2007-10-12  9:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-12  9:34 [PATCH] sched domain debug sysctl fixes Milton Miller
2007-10-12  9:35 ` [PATCH] sched.c: use kcalloc Milton Miller
2007-10-12  9:35 ` [PATCH] sched domain sysctl: register online cpus Milton Miller
2007-10-12  9:35 ` [PATCH] sched domain sysctl: free and rebuild when changing domains Milton Miller
2007-10-12  9:35 ` Milton Miller [this message]
2007-10-12  9:35 ` [PATCH] sched domain sysctl: sysctl tables can have no holes Milton Miller
2007-10-12  9:54 ` [PATCH] sched domain debug sysctl fixes Milton Miller
2007-10-15  7:47 ` Ingo Molnar
2007-10-15 23:40   ` [PATCH] sched domain sysctl: free kstrdup allocations Milton Miller
2007-10-16  8:44     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mm-sched-4@bga.com \
    --to=miltonm@bga.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox