mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: "Shaojie Sun" <sunshaojie@kylinos.cn>,
	"Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Shuah Khan" <shuah@kernel.org>,
	"Ridong Chen" <ridong.chen@linux.dev>
Cc: cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup/cpuset: Add test for partition root invalidation returning wrong CPUs
Date: Mon, 10 Aug 2026 13:58:19 -0400	[thread overview]
Message-ID: <4a8cec73-0b25-424d-9f0a-314e221211fa@redhat.com> (raw)
In-Reply-To: <20260807085950.10960-1-sunshaojie@kylinos.cn>


On 8/7/26 4:59 AM, Shaojie Sun wrote:
> Add a test case covering the bug fixed by
> commit 345f40166694 ("cgroup/cpuset: Return only actually allocated
> CPUs during partition invalidation"). The test verifies that when a
> sibling partition root changes its cpuset.cpus to overlap with another
> partition root, only actually allocated CPUs (effective_xcpus) are
> returned to the parent, not all CPUs in cpus_allowed.
>
> Signed-off-by: Shaojie Sun <sunshaojie@kylinos.cn>
> ---
>   tools/testing/selftests/cgroup/test_cpuset_prs.sh | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> index 0d41aa0d343d..a44e92c94081 100755
> --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> @@ -393,6 +393,12 @@ TEST_MATRIX=(
>   	"  C0-1:P1   .      .  P1:C2-3  C0-2     .      .      .     0 A1:0-1|XA1:0-1|B1:2-3 A1:P1|B1:P1"
>   	"   C0-1     .      .  P1:C2-3  C0-2     .      .      .     0 A1:0-1|B1:2-3 A1:P0|B1:P1"
>   
> +	# However, a partition root changing its own cpuset.cpus to overlap with
> +	# a sibling partition root will invalidate itself. Only actually allocated
> +	# CPUs (effective_xcpus) should be returned to the parent, not all CPUs
> +	# in cpus_allowed. The root cgroup effective CPUs must remain unchanged.
> +	"  C0-1:P1   .      .   C1-2:P1    .      .      .    C0-1    0 A1:0-1 A1:P1|B1:P-1"
> +

The cgroup hierarchy used by TEST_MATRIX may not suitable for doing this 
kind of test as you can't easily check the state of the parent cgroup. I 
would suggest you use the REMOTE_TEST_MATRIX hierarchy with p1, c11, 
c12. After making c12 conflicts with c11, you can check p1 to see if it 
has the right state.

Cheers,
Longman


>   	# cpuset.cpus can overlap with sibling cpuset.cpus.exclusive but not subsumed by it
>   	"   C0-3     .      .    C4-5     X5     .      .      .     0 A1:0-3|B1:4-5"
>   


  reply	other threads:[~2026-08-10 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  8:59 Shaojie Sun
2026-08-10 17:58 ` Waiman Long [this message]
2026-08-11  9:58   ` [PATCH v2] " Shaojie Sun
2026-08-11 18:33     ` Waiman Long
2026-08-12  2:26     ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a8cec73-0b25-424d-9f0a-314e221211fa@redhat.com \
    --to=longman@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=ridong.chen@linux.dev \
    --cc=shuah@kernel.org \
    --cc=sunshaojie@kylinos.cn \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®