<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/tools/testing/selftests/cgroup, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Merge tag 'cgroup-for-7.4-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup</title>
<updated>2026-11-15T22:17:31+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-11-15T22:17:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4b15991b3be43e9581aca489ec30a351310bb49d'/>
<id>4b15991b3be43e9581aca489ec30a351310bb49d</id>
<content type='text'>
Pull cgroup fixes from Tejun Heo:

 - A file notification racing the file's removal could re-arm the
   notification timer after it was shut down, corrupting the timer wheel
   or firing on freed memory.

 - The v1 freezer could leave an exiting task frozen forever after its
   cgroup was thawed or removed.

 - With memcg built without the block cgroup controller, memcg reclaim
   waited on writeback and could deadlock against a filesystem freeze.
   memcg now selects the controller.

 - cpuset partition state could go wrong when CPUs move between nested
   partitions or go offline: isolated CPUs leaked or went missing,
   invalid partitions kept exclusive CPUs or came back with no usable
   CPU, and expanding a remote partition could fail. Separately, a
   forked child could inherit a corrupted memory node mask.

* tag 'cgroup-for-7.4-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  cgroup/cpuset: Don't revive invalid partition without active CPU on hotplug
  cgroup/cpuset: Remove redundant WARN_ON_ONCE() in remote_cpus_update()
  memcg: make MEMCG select BLK_CGROUP
  cpuset: generalize the validate_partition() interface
  cpuset: settle isolation state when CPUs are given back to parent
  cgroup/cpuset: Correctly set isolated_cpus when switching partition state
  cgroup/cpuset: Protect current-&gt;mems_allowed read in cpuset_fork()
  selftests/cgroup: Fix "test_cpuset_prs.sh -v" failures
  cpuset: add early empty cpumask check in partition_xcpus_add/del
  cgroup/cpuset: Reset partition data when an invalid partition stays invalid
  cgroup/freezer: Fix exiting tasks left frozen forever after rmdir
  cgroup/freezer: walk exiting tasks in the v1 freezer
  cgroup: arm the notify timer only while the file exists
  cgroup/cpuset: Do housekeeping check when isolated child with root parent may get more xcpus
  cgroup/cpuset: Recompute effective cpumask in update_cpumasks_hier() after calling update_parent_effective_cpumask()
  cgroup/cpuset: Fix incorrect CPU accounting with parent's effective_xcpus expansion
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull cgroup fixes from Tejun Heo:

 - A file notification racing the file's removal could re-arm the
   notification timer after it was shut down, corrupting the timer wheel
   or firing on freed memory.

 - The v1 freezer could leave an exiting task frozen forever after its
   cgroup was thawed or removed.

 - With memcg built without the block cgroup controller, memcg reclaim
   waited on writeback and could deadlock against a filesystem freeze.
   memcg now selects the controller.

 - cpuset partition state could go wrong when CPUs move between nested
   partitions or go offline: isolated CPUs leaked or went missing,
   invalid partitions kept exclusive CPUs or came back with no usable
   CPU, and expanding a remote partition could fail. Separately, a
   forked child could inherit a corrupted memory node mask.

* tag 'cgroup-for-7.4-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  cgroup/cpuset: Don't revive invalid partition without active CPU on hotplug
  cgroup/cpuset: Remove redundant WARN_ON_ONCE() in remote_cpus_update()
  memcg: make MEMCG select BLK_CGROUP
  cpuset: generalize the validate_partition() interface
  cpuset: settle isolation state when CPUs are given back to parent
  cgroup/cpuset: Correctly set isolated_cpus when switching partition state
  cgroup/cpuset: Protect current-&gt;mems_allowed read in cpuset_fork()
  selftests/cgroup: Fix "test_cpuset_prs.sh -v" failures
  cpuset: add early empty cpumask check in partition_xcpus_add/del
  cgroup/cpuset: Reset partition data when an invalid partition stays invalid
  cgroup/freezer: Fix exiting tasks left frozen forever after rmdir
  cgroup/freezer: walk exiting tasks in the v1 freezer
  cgroup: arm the notify timer only while the file exists
  cgroup/cpuset: Do housekeeping check when isolated child with root parent may get more xcpus
  cgroup/cpuset: Recompute effective cpumask in update_cpumasks_hier() after calling update_parent_effective_cpumask()
  cgroup/cpuset: Fix incorrect CPU accounting with parent's effective_xcpus expansion
</pre>
</div>
</content>
</entry>
<entry>
<title>cpuset: generalize the validate_partition() interface</title>
<updated>2026-11-13T19:23:33+00:00</updated>
<author>
<name>Ridong Chen</name>
<email>chenridong@xiaomi.com</email>
</author>
<published>2026-11-12T03:19:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e234ed1bb82c96a5643fd70784f16cf3d72eeed3'/>
<id>e234ed1bb82c96a5643fd70784f16cf3d72eeed3</id>
<content type='text'>
Refactor validate_partition() to take the parent partition, the new
partition root state, the new effective exclusive CPUs and the CPUs to
be deleted, instead of a trial cpuset. A NULL parent stands for a
remote partition, whose CPUs come from top_cpuset. This makes the
interface flexible enough to handle both local and remote partition
validation.

This also fixes a false PERR_NOCPUS error when expanding a remote
partition. The no CPU left for tasks check in partition_cpus_change()
is done against the cgroup parent, but the CPUs of a remote partition
come from top_cpuset, not from its parent. For example, on a 4-CPU
system:

  echo 2-3 &gt; P/cpuset.cpus
  echo 2-3 &gt; P/cpuset.cpus.exclusive
  echo 2-3 &gt; P/C/cpuset.cpus
  echo 2 &gt; P/C/cpuset.cpus.exclusive
  echo root &gt; P/C/cpuset.cpus.partition
  (a task in P)
  echo 2-3 &gt; P/C/cpuset.cpus.exclusive
  cat P/C/cpuset.cpus.partition
  root invalid (Parent is not a partition root)

The effective_cpus of P is 3, a subset of the new exclusive CPUs 2-3 of
C, and P has a task, so the expansion is rejected. However, P is not a
partition root and does not give any CPU to C, and top_cpuset still has
CPUs 0-1 for the task. Enabling C directly with exclusive CPUs 2-3
succeeds, as remote_partition_enable() checks top_cpuset instead.

The no CPU left for tasks check now uses the given parent instead of
parent_cs(cs), and top_cpuset for a remote partition, as that is where
its CPUs are taken from.

The housekeeping conflict check is folded into validate_partition(). It
is skipped when the parent is not a valid partition root, as @cs can't
be a valid local partition in that case.

Use the new interface for local partition enablement in
update_parent_effective_cpumask() and in partition_cpus_change(),
replacing the open-coded checks there. The order of the checks is now
the same for both paths: empty CPUs, housekeeping conflict, then no CPU
left for tasks.

Add a test case to test_cpuset_prs.sh for the remote partition
expansion above.

Fixes: 181c8e091aae ("cgroup/cpuset: Introduce remote partition")
Signed-off-by: Ridong Chen &lt;chenridong@xiaomi.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Reviewed-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refactor validate_partition() to take the parent partition, the new
partition root state, the new effective exclusive CPUs and the CPUs to
be deleted, instead of a trial cpuset. A NULL parent stands for a
remote partition, whose CPUs come from top_cpuset. This makes the
interface flexible enough to handle both local and remote partition
validation.

This also fixes a false PERR_NOCPUS error when expanding a remote
partition. The no CPU left for tasks check in partition_cpus_change()
is done against the cgroup parent, but the CPUs of a remote partition
come from top_cpuset, not from its parent. For example, on a 4-CPU
system:

  echo 2-3 &gt; P/cpuset.cpus
  echo 2-3 &gt; P/cpuset.cpus.exclusive
  echo 2-3 &gt; P/C/cpuset.cpus
  echo 2 &gt; P/C/cpuset.cpus.exclusive
  echo root &gt; P/C/cpuset.cpus.partition
  (a task in P)
  echo 2-3 &gt; P/C/cpuset.cpus.exclusive
  cat P/C/cpuset.cpus.partition
  root invalid (Parent is not a partition root)

The effective_cpus of P is 3, a subset of the new exclusive CPUs 2-3 of
C, and P has a task, so the expansion is rejected. However, P is not a
partition root and does not give any CPU to C, and top_cpuset still has
CPUs 0-1 for the task. Enabling C directly with exclusive CPUs 2-3
succeeds, as remote_partition_enable() checks top_cpuset instead.

The no CPU left for tasks check now uses the given parent instead of
parent_cs(cs), and top_cpuset for a remote partition, as that is where
its CPUs are taken from.

The housekeeping conflict check is folded into validate_partition(). It
is skipped when the parent is not a valid partition root, as @cs can't
be a valid local partition in that case.

Use the new interface for local partition enablement in
update_parent_effective_cpumask() and in partition_cpus_change(),
replacing the open-coded checks there. The order of the checks is now
the same for both paths: empty CPUs, housekeeping conflict, then no CPU
left for tasks.

Add a test case to test_cpuset_prs.sh for the remote partition
expansion above.

Fixes: 181c8e091aae ("cgroup/cpuset: Introduce remote partition")
Signed-off-by: Ridong Chen &lt;chenridong@xiaomi.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Reviewed-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cgroup/cpuset: Correctly set isolated_cpus when switching partition state</title>
<updated>2026-11-10T19:21:40+00:00</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2026-11-10T02:24:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=56681bc448a80bb2473026b41c44c133766bc38d'/>
<id>56681bc448a80bb2473026b41c44c133766bc38d</id>
<content type='text'>
When update_prstate() is called to switch the partition state from
root to isolated or vice versa, the whole effective_xcpus is passed to
isolated_cpus_update(). However, if there are child partitions present,
some of the effective_xcpus are dedicated to those child partitions
and their partition states will remain the same or get invalidated in
the case of child root partition with isolated parent in the latter
update_cpumasks_hier() call. In the latter case, their exclusive CPUs
will be returned to their parent.

Therefore isolated_cpus may be set incorrectly with child partitions
underneath. Fix that by excluding their exclusive CPUs in computing
the correct cpumask of exclusive CPUs used by that partition alone.

Add new test cases into test_cpuset_prs.sh to test for such cases.

Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Cc: stable@vger.kernel.org # v6.8+
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Tested-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When update_prstate() is called to switch the partition state from
root to isolated or vice versa, the whole effective_xcpus is passed to
isolated_cpus_update(). However, if there are child partitions present,
some of the effective_xcpus are dedicated to those child partitions
and their partition states will remain the same or get invalidated in
the case of child root partition with isolated parent in the latter
update_cpumasks_hier() call. In the latter case, their exclusive CPUs
will be returned to their parent.

Therefore isolated_cpus may be set incorrectly with child partitions
underneath. Fix that by excluding their exclusive CPUs in computing
the correct cpumask of exclusive CPUs used by that partition alone.

Add new test cases into test_cpuset_prs.sh to test for such cases.

Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Cc: stable@vger.kernel.org # v6.8+
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Tested-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/cgroup: Fix "test_cpuset_prs.sh -v" failures</title>
<updated>2026-11-10T19:20:58+00:00</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2026-11-09T19:09:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8ef0c923104b4ba38249b364867d779f5a9b5dbe'/>
<id>8ef0c923104b4ba38249b364867d779f5a9b5dbe</id>
<content type='text'>
When the -v option is used to run test_cpuset_prs.sh, it activates the
use of sched-debug to determine the set of isolated CPUs which will
also consider 1-CPU partition as being isolated though they will not be
reflected in "cpuset.cpus.isolated". As a result, some of the expected
isolated CPUs values have 2 different set of values to correspond to
these two ways of determining isolated CPUs.

Commit 362212853cd0 ("cgroup/cpuset: Fix incorrect CPU accounting with
parent's effective_xcpus expansion") introduces some new test cases
which fail when the -v option is used. Update the test cases to make
them pass with the -v option as well.

Also remove an obsolete comment in update_parent_effective_cpumask()
of cpuset.c.

Reported-by: Tejun Heo &lt;tj@kernel.org&gt;
Link: https://lore.kernel.org/lkml/886a562b52b1c5094142d547a8336457@kernel.org
Fixes: 362212853cd0 ("cgroup/cpuset: Fix incorrect CPU accounting with parent's effective_xcpus expansion")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Tested-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the -v option is used to run test_cpuset_prs.sh, it activates the
use of sched-debug to determine the set of isolated CPUs which will
also consider 1-CPU partition as being isolated though they will not be
reflected in "cpuset.cpus.isolated". As a result, some of the expected
isolated CPUs values have 2 different set of values to correspond to
these two ways of determining isolated CPUs.

Commit 362212853cd0 ("cgroup/cpuset: Fix incorrect CPU accounting with
parent's effective_xcpus expansion") introduces some new test cases
which fail when the -v option is used. Update the test cases to make
them pass with the -v option as well.

Also remove an obsolete comment in update_parent_effective_cpumask()
of cpuset.c.

Reported-by: Tejun Heo &lt;tj@kernel.org&gt;
Link: https://lore.kernel.org/lkml/886a562b52b1c5094142d547a8336457@kernel.org
Fixes: 362212853cd0 ("cgroup/cpuset: Fix incorrect CPU accounting with parent's effective_xcpus expansion")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Tested-by: Ridong Chen &lt;ridong.chen@linux.dev&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cgroup/cpuset: Reset partition data when an invalid partition stays invalid</title>
<updated>2026-11-09T15:23:03+00:00</updated>
<author>
<name>Ridong Chen</name>
<email>chenridong@xiaomi.com</email>
</author>
<published>2026-11-07T12:00:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ba4834fc81ddc0b500843c827c09d3ff95a317a9'/>
<id>ba4834fc81ddc0b500843c827c09d3ff95a317a9</id>
<content type='text'>
When cpuset.cpus or cpuset.cpus.exclusive of a partition root is
changed, update_cpumask() and update_exclusive_cpumask() copy the new
effective_xcpus computed for the trial cpuset into the cpuset, and call
reset_partition_data() only if the partition was valid before and is
invalid now:

	if ((old_prs &gt; 0) &amp;&amp; !is_partition_valid(cs))
		reset_partition_data(cs);

An invalid partition root (old_prs &lt; 0) that stays invalid is not
covered. Its effective_xcpus is then left with the trial value, which
is computed from user_xcpus() and so falls back to cpuset.cpus when
cpuset.cpus.exclusive is cleared. As an invalid partition root does not
own any exclusive CPUs, and rm_siblings_excl_cpus() treats a non-empty
effective_xcpus of a sibling without cpuset.cpus.exclusive as owned,
those CPUs can then no longer be claimed by a sibling:

  # A1: cpuset.cpus=2-3, cpuset.cpus.exclusive=2-3, root, with tasks
  # offline CPUs 2-3 -&gt; A1 becomes invalid
  echo &gt; A1/cpuset.cpus.exclusive
  cat A1/cpuset.cpus.exclusive.effective    # 2-3, expected empty
  echo 3 &gt; B1/cpuset.cpus.exclusive         # -EINVAL

Reset the partition data whenever the cpuset is a partition root, valid
or not, and ends up invalid. As effective_xcpus may be cleared by that,
also force update_cpumasks_hier() to update the subtree, so that the
effective_xcpus of the descendants doesn't keep the released CPUs. Add
test cases for it.

Fixes: de9f15e21c55 ("cpuset: use parse_cpulist for setting cpus.exclusive")
Fixes: c5866c9a007d ("cpuset: refactor CPU mask buffer parsing logic")
Reported-by: Sashiko &lt;sashiko-bot@kernel.org&gt;
Link: https://sashiko.dev/#/patchset/20261101114206.2434398-1-ridong.chen%40linux.dev?part=15
Reviewed-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Ridong Chen &lt;chenridong@xiaomi.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When cpuset.cpus or cpuset.cpus.exclusive of a partition root is
changed, update_cpumask() and update_exclusive_cpumask() copy the new
effective_xcpus computed for the trial cpuset into the cpuset, and call
reset_partition_data() only if the partition was valid before and is
invalid now:

	if ((old_prs &gt; 0) &amp;&amp; !is_partition_valid(cs))
		reset_partition_data(cs);

An invalid partition root (old_prs &lt; 0) that stays invalid is not
covered. Its effective_xcpus is then left with the trial value, which
is computed from user_xcpus() and so falls back to cpuset.cpus when
cpuset.cpus.exclusive is cleared. As an invalid partition root does not
own any exclusive CPUs, and rm_siblings_excl_cpus() treats a non-empty
effective_xcpus of a sibling without cpuset.cpus.exclusive as owned,
those CPUs can then no longer be claimed by a sibling:

  # A1: cpuset.cpus=2-3, cpuset.cpus.exclusive=2-3, root, with tasks
  # offline CPUs 2-3 -&gt; A1 becomes invalid
  echo &gt; A1/cpuset.cpus.exclusive
  cat A1/cpuset.cpus.exclusive.effective    # 2-3, expected empty
  echo 3 &gt; B1/cpuset.cpus.exclusive         # -EINVAL

Reset the partition data whenever the cpuset is a partition root, valid
or not, and ends up invalid. As effective_xcpus may be cleared by that,
also force update_cpumasks_hier() to update the subtree, so that the
effective_xcpus of the descendants doesn't keep the released CPUs. Add
test cases for it.

Fixes: de9f15e21c55 ("cpuset: use parse_cpulist for setting cpus.exclusive")
Fixes: c5866c9a007d ("cpuset: refactor CPU mask buffer parsing logic")
Reported-by: Sashiko &lt;sashiko-bot@kernel.org&gt;
Link: https://sashiko.dev/#/patchset/20261101114206.2434398-1-ridong.chen%40linux.dev?part=15
Reviewed-by: Waiman Long &lt;longman@redhat.com&gt;
Signed-off-by: Ridong Chen &lt;chenridong@xiaomi.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cgroup/cpuset: Do housekeeping check when isolated child with root parent may get more xcpus</title>
<updated>2026-11-02T07:49:00+00:00</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2026-10-30T19:07:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8b89d073a6d993ab0f7c31413b74505982aedc28'/>
<id>8b89d073a6d993ab0f7c31413b74505982aedc28</id>
<content type='text'>
It is reported by sashiko and Guopeng that when an isolated child with
root parent gets more isolated CPUs from the expansion of the parent's
effective_xcpus, it is possible that all the active housekeeping CPUs
may be gone. So a prstate_housekeeping_conflict() should be performed
when that happens. Add the check to make sure that we can't exhaust
all the active housekeeping CPUs.

Test cases are added to the NOHZ_FULL_TEST_MATRIX of test_cpuset_prs.sh
to test that.

Reported-by: Guopeng Zhang &lt;guopeng.zhang@linux.dev&gt;
Link: https://lore.kernel.org/lkml/ed6fecb4-38e9-4a73-8c1a-7bdd80175a69@linux.dev
Fixes: e2ffe502ba45 ("cgroup/cpuset: Add cpuset.cpus.exclusive for v2")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is reported by sashiko and Guopeng that when an isolated child with
root parent gets more isolated CPUs from the expansion of the parent's
effective_xcpus, it is possible that all the active housekeeping CPUs
may be gone. So a prstate_housekeeping_conflict() should be performed
when that happens. Add the check to make sure that we can't exhaust
all the active housekeeping CPUs.

Test cases are added to the NOHZ_FULL_TEST_MATRIX of test_cpuset_prs.sh
to test that.

Reported-by: Guopeng Zhang &lt;guopeng.zhang@linux.dev&gt;
Link: https://lore.kernel.org/lkml/ed6fecb4-38e9-4a73-8c1a-7bdd80175a69@linux.dev
Fixes: e2ffe502ba45 ("cgroup/cpuset: Add cpuset.cpus.exclusive for v2")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cgroup/cpuset: Fix incorrect CPU accounting with parent's effective_xcpus expansion</title>
<updated>2026-11-02T07:48:52+00:00</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2026-10-30T19:06:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=362212853cd09796c275669e9fc3a25f282bd688'/>
<id>362212853cd09796c275669e9fc3a25f282bd688</id>
<content type='text'>
Commit ec0254b9eb49 ("cgroup/cpuset: Release invalid isolated CPUs with
a shrunk root partition parent") fixes incorrect isolated_cpus accounting
when contraction of a parent's effective_xcpus can cause a child partition
to lose isolated CPUs. Expansion of parent's effective_cpus can also allow
a child partition to gain more effective_xcpus. However, the current code
doesn't handle this case correctly leading to incorrect effective_cpus
and isolated_cpus accounting. Fix that by looking for this possible
expansion of effective_xcpus and perform the proper accounting action.

New test cases are added to test this effective_xcpus expansion scenarios.

Reported-by: Guopeng Zhang &lt;guopeng.zhang@linux.dev&gt;
Link: https://lore.kernel.org/lkml/20261027123837.100909-1-guopeng.zhang@linux.dev
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit ec0254b9eb49 ("cgroup/cpuset: Release invalid isolated CPUs with
a shrunk root partition parent") fixes incorrect isolated_cpus accounting
when contraction of a parent's effective_xcpus can cause a child partition
to lose isolated CPUs. Expansion of parent's effective_cpus can also allow
a child partition to gain more effective_xcpus. However, the current code
doesn't handle this case correctly leading to incorrect effective_cpus
and isolated_cpus accounting. Fix that by looking for this possible
expansion of effective_xcpus and perform the proper accounting action.

New test cases are added to test this effective_xcpus expansion scenarios.

Reported-by: Guopeng Zhang &lt;guopeng.zhang@linux.dev&gt;
Link: https://lore.kernel.org/lkml/20261027123837.100909-1-guopeng.zhang@linux.dev
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'cgroup-for-7.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup</title>
<updated>2026-10-29T17:35:19+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-10-29T17:35:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2152c755f76a9170218a098f79e2b081a08b1d6c'/>
<id>2152c755f76a9170218a098f79e2b081a08b1d6c</id>
<content type='text'>
Pull cgroup fixes from Tejun Heo:

 - cgroup.kill did not kill a process whose thread group leader had
   exited while other threads still ran, nor those threads once moved to
   another cgroup, letting a process survive its container being killed

 - A cgroup.procs write under favordynmods could migrate a newly forked
   process before fork linked it to its cgroup, corrupting cgroup task
   lists

 - cpuset partition fixes for nested hierarchies: invalidation, revival,
   shrinking and switches between root and isolated could leak isolated
   CPUs, skip or miscompute the housekeeping check, or leave wrong
   effective CPUs:

     - A root partition can no longer be created under an isolated
       parent or stay valid under one, as disabling it could leave no
       housekeeping CPUs

     - Enabling a partition failed when a grandchild held tasks,
       although the parent had none of its own

     - Separately, an allocation racing with a cpuset.mems update could
       drop its mempolicy nodemask and land on the wrong node, and a
       memoryless node in cpuset.mems triggered a spurious "movable
       nodes only" warning

     - Two no-functional-change cleanups of the effective CPU
       computation

* tag 'cgroup-for-7.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (27 commits)
  cgroup/cpuset: Integrate compute_partition_effective_cpumask() into compute_effective_cpumask()
  cgroup/cpuset: Relocate compute_*effective_cpumask() and compute_effective_nodemask()
  cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent
  cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask()
  cgroup/cpuset: Make sure compute_partition_effective_cpumask() is only called for valid partition
  cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier()
  selftests/cgroup: Check for a single range nohz_full CPUs before running test matrix
  cgroup/cpuset: Minor fixes to prstate_housekeeping_conflict()
  cgroup/cpuset: Fix incorrect effective_cpus bug in update_cpumasks_hier()
  cgroup/cpuset: Properly compute effective xcpus in update_parent_effective_cpumask()
  cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition
  cgroup: don't kill migrated processes through their exiting threads
  cgroup/cpuset: check effective mems for a movable-only configuration
  cgroup/cpuset: Fix task checking when enabling a partition
  cgroup: serialize migrations of newly forked processes
  selftests/cgroup: test cgroup.kill with an exited thread group leader
  cgroup: fix cgroup.kill for exited thread group leader
  selftests/cgroup: Skip test_cpuset_prs.sh test if some required CPUs are offline
  selftests/cgroup: Add tests for nohz_full housekeeping check
  selftests/cgroup: Add tests for isolcpus housekeeping check
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull cgroup fixes from Tejun Heo:

 - cgroup.kill did not kill a process whose thread group leader had
   exited while other threads still ran, nor those threads once moved to
   another cgroup, letting a process survive its container being killed

 - A cgroup.procs write under favordynmods could migrate a newly forked
   process before fork linked it to its cgroup, corrupting cgroup task
   lists

 - cpuset partition fixes for nested hierarchies: invalidation, revival,
   shrinking and switches between root and isolated could leak isolated
   CPUs, skip or miscompute the housekeeping check, or leave wrong
   effective CPUs:

     - A root partition can no longer be created under an isolated
       parent or stay valid under one, as disabling it could leave no
       housekeeping CPUs

     - Enabling a partition failed when a grandchild held tasks,
       although the parent had none of its own

     - Separately, an allocation racing with a cpuset.mems update could
       drop its mempolicy nodemask and land on the wrong node, and a
       memoryless node in cpuset.mems triggered a spurious "movable
       nodes only" warning

     - Two no-functional-change cleanups of the effective CPU
       computation

* tag 'cgroup-for-7.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (27 commits)
  cgroup/cpuset: Integrate compute_partition_effective_cpumask() into compute_effective_cpumask()
  cgroup/cpuset: Relocate compute_*effective_cpumask() and compute_effective_nodemask()
  cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent
  cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask()
  cgroup/cpuset: Make sure compute_partition_effective_cpumask() is only called for valid partition
  cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier()
  selftests/cgroup: Check for a single range nohz_full CPUs before running test matrix
  cgroup/cpuset: Minor fixes to prstate_housekeeping_conflict()
  cgroup/cpuset: Fix incorrect effective_cpus bug in update_cpumasks_hier()
  cgroup/cpuset: Properly compute effective xcpus in update_parent_effective_cpumask()
  cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition
  cgroup: don't kill migrated processes through their exiting threads
  cgroup/cpuset: check effective mems for a movable-only configuration
  cgroup/cpuset: Fix task checking when enabling a partition
  cgroup: serialize migrations of newly forked processes
  selftests/cgroup: test cgroup.kill with an exited thread group leader
  cgroup: fix cgroup.kill for exited thread group leader
  selftests/cgroup: Skip test_cpuset_prs.sh test if some required CPUs are offline
  selftests/cgroup: Add tests for nohz_full housekeeping check
  selftests/cgroup: Add tests for isolcpus housekeeping check
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent</title>
<updated>2026-10-26T17:44:36+00:00</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2026-10-25T23:53:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ec0254b9eb49ebc9383dc3ae5cb69c8606f88499'/>
<id>ec0254b9eb49ebc9383dc3ae5cb69c8606f88499</id>
<content type='text'>
It is also reported by sashiko that there may be leakages of isolated
CPUs when a root partition parent shrinks its effective_xcpus with
isolated partition children. Leakage here means that isolated_cpus may
contain extra CPUs that are not in any isolated partitions and not boot
time isolated. Those CPUs cannot be used in any isolated partitions
anymore.

There are 2 different cases here. The effective_xcpus becomes empty and
the isolated partition should be invalidated in this case. Alternatively
some of its effective_xcpus are not in parent's effective xcpus but
still have some valid effective_xcpus left. The isolated partition can
remain valid. In both cases, the invalid isolated CPUs will have to be
released from isolated_cpus if appropriate.

Fix that by calling isolated_cpus_release() to release those isolated
CPUs from isolated_cpus.

New test cases are added to test_cpuset_prs.sh to test this.

Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is also reported by sashiko that there may be leakages of isolated
CPUs when a root partition parent shrinks its effective_xcpus with
isolated partition children. Leakage here means that isolated_cpus may
contain extra CPUs that are not in any isolated partitions and not boot
time isolated. Those CPUs cannot be used in any isolated partitions
anymore.

There are 2 different cases here. The effective_xcpus becomes empty and
the isolated partition should be invalidated in this case. Alternatively
some of its effective_xcpus are not in parent's effective xcpus but
still have some valid effective_xcpus left. The isolated partition can
remain valid. In both cases, the invalid isolated CPUs will have to be
released from isolated_cpus if appropriate.

Fix that by calling isolated_cpus_release() to release those isolated
CPUs from isolated_cpus.

New test cases are added to test_cpuset_prs.sh to test this.

Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask()</title>
<updated>2026-10-26T17:44:32+00:00</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2026-10-25T21:44:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a7d89d92fdfbceb678d82710135d4eee2623d727'/>
<id>a7d89d92fdfbceb678d82710135d4eee2623d727</id>
<content type='text'>
It is found by sashiko that when a child isolated partition with parent
root partition is invalidated in compute_partition_effective_cpumask(),
the switching of the isolated exclusive CPUs from child to parent will
not be reflected in isolated_cpus leading to CPU leakage. Fix that by
calling isolated_cpus_update() when that happens.

Also simplify compute_partition_effective_cpumask() by doing
child partition invalidation only for the special case of no more
effective_cpus left in a populated parent. The other case doesn't
actually warrant invalidation at this stage and subsequent iteration
in update_cpumasks_hier() and update_parent_effective_cpumask() for
that child should handle that.

Also drop the make_partition_invalid() helper by inlining it into
compute_partition_effective_cpumask() as it is the only caller.

A new test case is add to test_cpuset_prs.sh to verify this.

Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is found by sashiko that when a child isolated partition with parent
root partition is invalidated in compute_partition_effective_cpumask(),
the switching of the isolated exclusive CPUs from child to parent will
not be reflected in isolated_cpus leading to CPU leakage. Fix that by
calling isolated_cpus_update() when that happens.

Also simplify compute_partition_effective_cpumask() by doing
child partition invalidation only for the special case of no more
effective_cpus left in a populated parent. The other case doesn't
actually warrant invalidation at this stage and subsequent iteration
in update_cpumasks_hier() and update_parent_effective_cpumask() for
that child should handle that.

Also drop the make_partition_invalid() helper by inlining it into
compute_partition_effective_cpumask() as it is the only caller.

A new test case is add to test_cpuset_prs.sh to verify this.

Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Reviewed-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Tested-by: Guopeng Zhang &lt;zhangguopeng@kylinos.cn&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
