summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorRoman Kiryanov <rkir@google.com>2019-06-19 11:11:59 -0700
committerRoman Kiryanov <rkir@google.com>2019-06-19 11:13:11 -0700
commiteee21eb4a63540a3f3201d0db8d43226a1896c91 (patch)
treede4f15dafddc9e6a696075e7799aa36053b0c66d /kernel
parentf1adac4c222bda2d85b683f95069e974d8b9665f (diff)
ANDROID: kernel: cgroup: cpuset: Clear cpus_requested for empty buf
update_cpumask had a special case for empty buf which did not update cpus_requested. This change reduces differences (only to parsing) in empty/non-empty codepaths to make them consistent. Bug: 120444281 Fixes: 4803def4e0b2 ("ANDROID: cpuset: Make cpusets restore on hotplug") Test: check that writes to /dev/cpuset/background/tasks Test: work as expected, e.g.: Test: echo $$ > /dev/cpuset/background/tasks Test: echo > /dev/cpuset/background/tasks Signed-off-by: Roman Kiryanov <rkir@google.com> Change-Id: I49d320ea046636ec38bd23f053317abc59f64f8e
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpuset.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 9ad9d458df1e..3190ef04e033 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -956,23 +956,23 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
return -EACCES;
/*
- * An empty cpus_allowed is ok only if the cpuset has no tasks.
+ * An empty cpus_requested is ok only if the cpuset has no tasks.
* Since cpulist_parse() fails on an empty mask, we special case
* that parsing. The validate_change() call ensures that cpusets
* with tasks have cpus.
*/
if (!*buf) {
- cpumask_clear(trialcs->cpus_allowed);
+ cpumask_clear(trialcs->cpus_requested);
} else {
retval = cpulist_parse(buf, trialcs->cpus_requested);
if (retval < 0)
return retval;
+ }
- if (!cpumask_subset(trialcs->cpus_requested, cpu_present_mask))
- return -EINVAL;
+ if (!cpumask_subset(trialcs->cpus_requested, cpu_present_mask))
+ return -EINVAL;
- cpumask_and(trialcs->cpus_allowed, trialcs->cpus_requested, cpu_active_mask);
- }
+ cpumask_and(trialcs->cpus_allowed, trialcs->cpus_requested, cpu_active_mask);
/* Nothing to do if the cpus didn't change */
if (cpumask_equal(cs->cpus_requested, trialcs->cpus_requested))