diff options
author | Li Zefan <lizefan@huawei.com> | 2013-06-05 05:15:59 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-06-05 16:55:14 -0400 |
commit | a73456f37b9dbc917398387d0cba926b4455b70f (patch) | |
tree | f719feff0ea9d7d42b0015a4cd388e2f5b072a4b /kernel | |
parent | 249cc86db7492dc8de1d2eddebc6bcc4ab2a8e9e (diff) |
cpuset: re-structure update_cpumask() a bit
Check if cpus_allowed is to be changed before calling validate_change().
This won't change any behavior, but later it will allow us to do this:
# mkdir /cpuset/child
# echo $$ > /cpuset/child/tasks /* empty cpuset */
# echo > /cpuset/child/cpuset.cpus /* do nothing, won't fail */
Without this patch, the last operation will fail.
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpuset.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 51f8e1d5a2a9..535dce685eec 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -856,14 +856,15 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, | |||
856 | if (!cpumask_subset(trialcs->cpus_allowed, cpu_active_mask)) | 856 | if (!cpumask_subset(trialcs->cpus_allowed, cpu_active_mask)) |
857 | return -EINVAL; | 857 | return -EINVAL; |
858 | } | 858 | } |
859 | retval = validate_change(cs, trialcs); | ||
860 | if (retval < 0) | ||
861 | return retval; | ||
862 | 859 | ||
863 | /* Nothing to do if the cpus didn't change */ | 860 | /* Nothing to do if the cpus didn't change */ |
864 | if (cpumask_equal(cs->cpus_allowed, trialcs->cpus_allowed)) | 861 | if (cpumask_equal(cs->cpus_allowed, trialcs->cpus_allowed)) |
865 | return 0; | 862 | return 0; |
866 | 863 | ||
864 | retval = validate_change(cs, trialcs); | ||
865 | if (retval < 0) | ||
866 | return retval; | ||
867 | |||
867 | retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL); | 868 | retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL); |
868 | if (retval) | 869 | if (retval) |
869 | return retval; | 870 | return retval; |