aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpuset.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index dca455e0482e..3778a21a4662 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1057,13 +1057,15 @@ static void *cpuset_being_rebound;
1057 * update_tasks_nodemask - Update the nodemasks of tasks in the cpuset. 1057 * update_tasks_nodemask - Update the nodemasks of tasks in the cpuset.
1058 * @cs: the cpuset in which each task's mems_allowed mask needs to be changed 1058 * @cs: the cpuset in which each task's mems_allowed mask needs to be changed
1059 * @oldmem: old mems_allowed of cpuset cs 1059 * @oldmem: old mems_allowed of cpuset cs
1060 * @heap: if NULL, defer allocating heap memory to cgroup_scan_tasks()
1060 * 1061 *
1061 * Called with cgroup_mutex held 1062 * Called with cgroup_mutex held
1062 * Return 0 if successful, -errno if not. 1063 * No return value. It's guaranteed that cgroup_scan_tasks() always returns 0
1064 * if @heap != NULL.
1063 */ 1065 */
1064static int update_tasks_nodemask(struct cpuset *cs, const nodemask_t *oldmem) 1066static void update_tasks_nodemask(struct cpuset *cs, const nodemask_t *oldmem,
1067 struct ptr_heap *heap)
1065{ 1068{
1066 int retval;
1067 struct cgroup_scanner scan; 1069 struct cgroup_scanner scan;
1068 1070
1069 cpuset_being_rebound = cs; /* causes mpol_dup() rebind */ 1071 cpuset_being_rebound = cs; /* causes mpol_dup() rebind */
@@ -1071,7 +1073,7 @@ static int update_tasks_nodemask(struct cpuset *cs, const nodemask_t *oldmem)
1071 scan.cg = cs->css.cgroup; 1073 scan.cg = cs->css.cgroup;
1072 scan.test_task = NULL; 1074 scan.test_task = NULL;
1073 scan.process_task = cpuset_change_nodemask; 1075 scan.process_task = cpuset_change_nodemask;
1074 scan.heap = NULL; 1076 scan.heap = heap;
1075 scan.data = (nodemask_t *)oldmem; 1077 scan.data = (nodemask_t *)oldmem;
1076 1078
1077 /* 1079 /*
@@ -1084,12 +1086,10 @@ static int update_tasks_nodemask(struct cpuset *cs, const nodemask_t *oldmem)
1084 * It's ok if we rebind the same mm twice; mpol_rebind_mm() 1086 * It's ok if we rebind the same mm twice; mpol_rebind_mm()
1085 * is idempotent. Also migrate pages in each mm to new nodes. 1087 * is idempotent. Also migrate pages in each mm to new nodes.
1086 */ 1088 */
1087 retval = cgroup_scan_tasks(&scan); 1089 cgroup_scan_tasks(&scan);
1088 1090
1089 /* We're done rebinding vmas to this cpuset's new mems_allowed. */ 1091 /* We're done rebinding vmas to this cpuset's new mems_allowed. */
1090 cpuset_being_rebound = NULL; 1092 cpuset_being_rebound = NULL;
1091
1092 return retval;
1093} 1093}
1094 1094
1095/* 1095/*
@@ -1110,6 +1110,7 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
1110{ 1110{
1111 nodemask_t oldmem; 1111 nodemask_t oldmem;
1112 int retval; 1112 int retval;
1113 struct ptr_heap heap;
1113 1114
1114 /* 1115 /*
1115 * top_cpuset.mems_allowed tracks node_stats[N_HIGH_MEMORY]; 1116 * top_cpuset.mems_allowed tracks node_stats[N_HIGH_MEMORY];
@@ -1144,12 +1145,18 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
1144 if (retval < 0) 1145 if (retval < 0)
1145 goto done; 1146 goto done;
1146 1147
1148 retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL);
1149 if (retval < 0)
1150 goto done;
1151
1147 mutex_lock(&callback_mutex); 1152 mutex_lock(&callback_mutex);
1148 cs->mems_allowed = trialcs->mems_allowed; 1153 cs->mems_allowed = trialcs->mems_allowed;
1149 cs->mems_generation = cpuset_mems_generation++; 1154 cs->mems_generation = cpuset_mems_generation++;
1150 mutex_unlock(&callback_mutex); 1155 mutex_unlock(&callback_mutex);
1151 1156
1152 retval = update_tasks_nodemask(cs, &oldmem); 1157 update_tasks_nodemask(cs, &oldmem, &heap);
1158
1159 heap_free(&heap);
1153done: 1160done:
1154 return retval; 1161 return retval;
1155} 1162}
@@ -2003,7 +2010,7 @@ static void scan_for_empty_cpusets(struct cpuset *root)
2003 remove_tasks_in_empty_cpuset(cp); 2010 remove_tasks_in_empty_cpuset(cp);
2004 else { 2011 else {
2005 update_tasks_cpumask(cp, NULL); 2012 update_tasks_cpumask(cp, NULL);
2006 update_tasks_nodemask(cp, &oldmems); 2013 update_tasks_nodemask(cp, &oldmems, NULL);
2007 } 2014 }
2008 } 2015 }
2009} 2016}