Skip to content

Commit 3957a57

Browse files
committed
Merge tag 'cgroup-for-6.17-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup fixes from Tejun Heo: - Fix NULL de-ref in css_rstat_exit() which could happen after allocation failure - Fix a cpuset partition handling bug and a couple other misc issues - Doc spelling fix * tag 'cgroup-for-6.17-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: docs: cgroup: fixed spelling mistakes in documentation cgroup: avoid null de-ref in css_rstat_exit() cgroup/cpuset: Remove the unnecessary css_get/put() in cpuset_partition_write() cgroup/cpuset: Fix a partition error with CPU hotplug cgroup/cpuset: Use static_branch_enable_cpuslocked() on cpusets_insane_config_key
2 parents 9a36b58 + 6563623 commit 3957a57

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ both cgroups.
435435
Controlling Controllers
436436
-----------------------
437437

438-
Availablity
439-
~~~~~~~~~~~
438+
Availability
439+
~~~~~~~~~~~~
440440

441441
A controller is available in a cgroup when it is supported by the kernel (i.e.,
442442
compiled in, not disabled and not attached to a v1 hierarchy) and listed in the

kernel/cgroup/cpuset.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static inline void check_insane_mems_config(nodemask_t *nodes)
280280
{
281281
if (!cpusets_insane_config() &&
282282
movable_only_nodes(nodes)) {
283-
static_branch_enable(&cpusets_insane_config_key);
283+
static_branch_enable_cpuslocked(&cpusets_insane_config_key);
284284
pr_info("Unsupported (movable nodes only) cpuset configuration detected (nmask=%*pbl)!\n"
285285
"Cpuset allocations might fail even with a lot of memory available.\n",
286286
nodemask_pr_args(nodes));
@@ -1843,7 +1843,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
18431843
if (is_partition_valid(cs))
18441844
adding = cpumask_and(tmp->addmask,
18451845
xcpus, parent->effective_xcpus);
1846-
} else if (is_partition_invalid(cs) &&
1846+
} else if (is_partition_invalid(cs) && !cpumask_empty(xcpus) &&
18471847
cpumask_subset(xcpus, parent->effective_xcpus)) {
18481848
struct cgroup_subsys_state *css;
18491849
struct cpuset *child;
@@ -3358,14 +3358,12 @@ static ssize_t cpuset_partition_write(struct kernfs_open_file *of, char *buf,
33583358
else
33593359
return -EINVAL;
33603360

3361-
css_get(&cs->css);
33623361
cpus_read_lock();
33633362
mutex_lock(&cpuset_mutex);
33643363
if (is_cpuset_online(cs))
33653364
retval = update_prstate(cs, val);
33663365
mutex_unlock(&cpuset_mutex);
33673366
cpus_read_unlock();
3368-
css_put(&cs->css);
33693367
return retval ?: nbytes;
33703368
}
33713369

@@ -3870,9 +3868,10 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp)
38703868
partcmd = partcmd_invalidate;
38713869
/*
38723870
* On the other hand, an invalid partition root may be transitioned
3873-
* back to a regular one.
3871+
* back to a regular one with a non-empty effective xcpus.
38743872
*/
3875-
else if (is_partition_valid(parent) && is_partition_invalid(cs))
3873+
else if (is_partition_valid(parent) && is_partition_invalid(cs) &&
3874+
!cpumask_empty(cs->effective_xcpus))
38763875
partcmd = partcmd_update;
38773876

38783877
if (partcmd >= 0) {

kernel/cgroup/rstat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,9 @@ void css_rstat_exit(struct cgroup_subsys_state *css)
479479
if (!css_uses_rstat(css))
480480
return;
481481

482+
if (!css->rstat_cpu)
483+
return;
484+
482485
css_rstat_flush(css);
483486

484487
/* sanity check */

0 commit comments

Comments
 (0)