The patch titled
cpuset sched_load_balance kmalloc fix
has been added to the -mm tree. Its filename is
cpuset-sched_load_balance-kmalloc-fix.patch
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this
------------------------------------------------------
Subject: cpuset sched_load_balance kmalloc fix
From: Paul Jackson <[EMAIL PROTECTED]>
Properly check return value of kmalloc'd dynamic sched domain cpumasks, and
fallback to a non-kmalloc'd default (one large sched domain) if kmalloc
fails.
Signed-off-by: Paul Jackson <[EMAIL PROTECTED]>
Cc: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---
kernel/cpuset.c | 4 +++-
kernel/sched.c | 25 ++++++++++++++++++++++---
2 files changed, 25 insertions(+), 4 deletions(-)
diff -puN kernel/cpuset.c~cpuset-sched_load_balance-kmalloc-fix kernel/cpuset.c
--- a/kernel/cpuset.c~cpuset-sched_load_balance-kmalloc-fix
+++ a/kernel/cpuset.c
@@ -587,6 +587,8 @@ static void rebuild_sched_domains(void)
if (is_sched_load_balance(&top_cpuset)) {
ndoms = 1;
doms = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
+ if (!doms)
+ goto rebuild;
*doms = top_cpuset.cpus_allowed;
goto rebuild;
}
@@ -640,7 +642,7 @@ restart:
/* Convert <csn, csa> to <ndoms, doms> */
doms = kmalloc(ndoms * sizeof(cpumask_t), GFP_KERNEL);
if (!doms)
- goto done;
+ goto rebuild;
for (nslot = 0, i = 0; i < csn; i++) {
struct cpuset *a = csa[i];
diff -puN kernel/sched.c~cpuset-sched_load_balance-kmalloc-fix kernel/sched.c
--- a/kernel/sched.c~cpuset-sched_load_balance-kmalloc-fix
+++ a/kernel/sched.c
@@ -6329,6 +6329,13 @@ static cpumask_t *doms_cur; /* current s
static int ndoms_cur; /* number of sched domains in 'doms_cur' */
/*
+ * Special case: If a kmalloc of a doms_cur partition (array of
+ * cpumask_t) fails, then fallback to a single sched domain,
+ * as determined by the single cpumask_t fallback_doms.
+ */
+static cpumask_t fallback_doms;
+
+/*
* Set up scheduler domains and groups. Callers must hold the hotplug lock.
* For now this just excludes isolated cpus, but could be used to
* exclude other special cases in the future.
@@ -6337,6 +6344,8 @@ static int arch_init_sched_domains(const
{
ndoms_cur = 1;
doms_cur = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
+ if (!doms_cur)
+ doms_cur = &fallback_doms;
cpus_andnot(*doms_cur, *cpu_map, cpu_isolated_map);
register_sched_domain_sysctl();
return build_sched_domains(doms_cur);
@@ -6376,8 +6385,11 @@ static void detach_destroy_domains(const
* current 'doms_cur' domains and in the new 'doms_new', we can leave
* it as it is.
*
- * The passed in 'doms_new' must be kmalloc'd, and this routine takes
- * ownership of it and will kfree it when done with it.
+ * The passed in 'doms_new' should be kmalloc'd. This routine takes
+ * ownership of it and will kfree it when done with it. If the caller
+ * failed the kmalloc call, then it can pass in doms_new == NULL,
+ * and partition_sched_domains() will fallback to the single partition
+ * 'fallback_doms'.
*
* Call with hotplug lock held
*/
@@ -6385,6 +6397,12 @@ void partition_sched_domains(int ndoms_n
{
int i, j;
+ if (doms_new == NULL) {
+ ndoms_new = 1;
+ doms_new = &fallback_doms;
+ cpus_andnot(doms_new[0], cpu_online_map, cpu_isolated_map);
+ }
+
/* Destroy deleted domains */
for (i = 0; i < ndoms_cur; i++) {
for (j = 0; j < ndoms_new; j++) {
@@ -6410,7 +6428,8 @@ match2:
}
/* Remember the new sched domains */
- kfree(doms_cur);
+ if (doms_cur != &fallback_doms)
+ kfree(doms_cur);
doms_cur = doms_new;
ndoms_cur = ndoms_new;
}
_
Patches currently in -mm which might be from [EMAIL PROTECTED] are
origin.patch
git-scsi-misc.patch
cpuset-zero-malloc-revert-the-old-cpuset-fix.patch
task-containersv11-basic-task-container-framework.patch
task-containersv11-add-tasks-file-interface.patch
task-containersv11-add-fork-exit-hooks.patch
task-containersv11-add-container_clone-interface.patch
task-containersv11-add-procfs-interface.patch
task-containersv11-shared-container-subsystem-group-arrays.patch
task-containersv11-automatic-userspace-notification-of-idle-containers.patch
task-containersv11-automatic-userspace-notification-of-idle-containers-fix.patch
task-containersv11-make-cpusets-a-client-of-containers.patch
task-containersv11-example-cpu-accounting-subsystem.patch
task-containersv11-simple-task-container-debug-info-subsystem.patch
task-containers-enable-containers-by-default-in-some-configs.patch
whitespace-fixes-cpuset.patch
cpuset-sched_load_balance-flag.patch
cpuset-sched_load_balance-flag-fix.patch
cpuset-sched_load_balance-kmalloc-fix.patch
cpusets-decrustify-cpuset-mask-update-code.patch
cpusets-decrustify-cpuset-mask-update-code-checkpatch-fixes.patch
control-groups-replace-cont-with-cgrp-and-other-misc.patch
hotplug-cpu-migrate-a-task-within-its-cpuset.patch
hotplug-cpu-migrate-a-task-within-its-cpuset-fix.patch
hotplug-cpu-migrate-a-task-within-its-cpuset-whitespace-fix.patch
hotplug-cpu-migrate-a-task-within-its-cpuset-doc.patch
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html