diff options
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r-- | kernel/cpuset.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 9fceb97e989c..459d601947a8 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1194,6 +1194,15 @@ static int cpuset_can_attach(struct cgroup_subsys *ss, | |||
1194 | 1194 | ||
1195 | if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)) | 1195 | if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)) |
1196 | return -ENOSPC; | 1196 | return -ENOSPC; |
1197 | if (tsk->flags & PF_THREAD_BOUND) { | ||
1198 | cpumask_t mask; | ||
1199 | |||
1200 | mutex_lock(&callback_mutex); | ||
1201 | mask = cs->cpus_allowed; | ||
1202 | mutex_unlock(&callback_mutex); | ||
1203 | if (!cpus_equal(tsk->cpus_allowed, mask)) | ||
1204 | return -EINVAL; | ||
1205 | } | ||
1197 | 1206 | ||
1198 | return security_task_setscheduler(tsk, 0, NULL); | 1207 | return security_task_setscheduler(tsk, 0, NULL); |
1199 | } | 1208 | } |
@@ -1207,11 +1216,14 @@ static void cpuset_attach(struct cgroup_subsys *ss, | |||
1207 | struct mm_struct *mm; | 1216 | struct mm_struct *mm; |
1208 | struct cpuset *cs = cgroup_cs(cont); | 1217 | struct cpuset *cs = cgroup_cs(cont); |
1209 | struct cpuset *oldcs = cgroup_cs(oldcont); | 1218 | struct cpuset *oldcs = cgroup_cs(oldcont); |
1219 | int err; | ||
1210 | 1220 | ||
1211 | mutex_lock(&callback_mutex); | 1221 | mutex_lock(&callback_mutex); |
1212 | guarantee_online_cpus(cs, &cpus); | 1222 | guarantee_online_cpus(cs, &cpus); |
1213 | set_cpus_allowed_ptr(tsk, &cpus); | 1223 | err = set_cpus_allowed_ptr(tsk, &cpus); |
1214 | mutex_unlock(&callback_mutex); | 1224 | mutex_unlock(&callback_mutex); |
1225 | if (err) | ||
1226 | return; | ||
1215 | 1227 | ||
1216 | from = oldcs->mems_allowed; | 1228 | from = oldcs->mems_allowed; |
1217 | to = cs->mems_allowed; | 1229 | to = cs->mems_allowed; |
@@ -1882,7 +1894,7 @@ static void scan_for_empty_cpusets(const struct cpuset *root) | |||
1882 | * in order to minimize text size. | 1894 | * in order to minimize text size. |
1883 | */ | 1895 | */ |
1884 | 1896 | ||
1885 | static void common_cpu_mem_hotplug_unplug(void) | 1897 | static void common_cpu_mem_hotplug_unplug(int rebuild_sd) |
1886 | { | 1898 | { |
1887 | cgroup_lock(); | 1899 | cgroup_lock(); |
1888 | 1900 | ||
@@ -1894,7 +1906,8 @@ static void common_cpu_mem_hotplug_unplug(void) | |||
1894 | * Scheduler destroys domains on hotplug events. | 1906 | * Scheduler destroys domains on hotplug events. |
1895 | * Rebuild them based on the current settings. | 1907 | * Rebuild them based on the current settings. |
1896 | */ | 1908 | */ |
1897 | rebuild_sched_domains(); | 1909 | if (rebuild_sd) |
1910 | rebuild_sched_domains(); | ||
1898 | 1911 | ||
1899 | cgroup_unlock(); | 1912 | cgroup_unlock(); |
1900 | } | 1913 | } |
@@ -1912,11 +1925,22 @@ static void common_cpu_mem_hotplug_unplug(void) | |||
1912 | static int cpuset_handle_cpuhp(struct notifier_block *unused_nb, | 1925 | static int cpuset_handle_cpuhp(struct notifier_block *unused_nb, |
1913 | unsigned long phase, void *unused_cpu) | 1926 | unsigned long phase, void *unused_cpu) |
1914 | { | 1927 | { |
1915 | if (phase == CPU_DYING || phase == CPU_DYING_FROZEN) | 1928 | switch (phase) { |
1929 | case CPU_UP_CANCELED: | ||
1930 | case CPU_UP_CANCELED_FROZEN: | ||
1931 | case CPU_DOWN_FAILED: | ||
1932 | case CPU_DOWN_FAILED_FROZEN: | ||
1933 | case CPU_ONLINE: | ||
1934 | case CPU_ONLINE_FROZEN: | ||
1935 | case CPU_DEAD: | ||
1936 | case CPU_DEAD_FROZEN: | ||
1937 | common_cpu_mem_hotplug_unplug(1); | ||
1938 | break; | ||
1939 | default: | ||
1916 | return NOTIFY_DONE; | 1940 | return NOTIFY_DONE; |
1941 | } | ||
1917 | 1942 | ||
1918 | common_cpu_mem_hotplug_unplug(); | 1943 | return NOTIFY_OK; |
1919 | return 0; | ||
1920 | } | 1944 | } |
1921 | 1945 | ||
1922 | #ifdef CONFIG_MEMORY_HOTPLUG | 1946 | #ifdef CONFIG_MEMORY_HOTPLUG |
@@ -1929,7 +1953,7 @@ static int cpuset_handle_cpuhp(struct notifier_block *unused_nb, | |||
1929 | 1953 | ||
1930 | void cpuset_track_online_nodes(void) | 1954 | void cpuset_track_online_nodes(void) |
1931 | { | 1955 | { |
1932 | common_cpu_mem_hotplug_unplug(); | 1956 | common_cpu_mem_hotplug_unplug(0); |
1933 | } | 1957 | } |
1934 | #endif | 1958 | #endif |
1935 | 1959 | ||