mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Ridong <chenridong@huaweicloud.com>
To: "Waiman Long" <llong@redhat.com>, "Michal Koutný" <mkoutny@suse.com>
Cc: Sun Shaojie <sunshaojie@kylinos.cn>,
	cgroups@vger.kernel.org, hannes@cmpxchg.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	shuah@kernel.org, tj@kernel.org
Subject: Re: [PATCH v5] cpuset: Avoid invalidating sibling partitions on cpuset.cpus conflict.
Date: Thu, 27 Nov 2025 09:55:21 +0800	[thread overview]
Message-ID: <45f5e2c6-42ec-4d77-9c2d-0e00472a05de@huaweicloud.com> (raw)
In-Reply-To: <d5d635df-94f3-4909-afe3-f2e6141afa32@redhat.com>



On 2025/11/27 3:43, Waiman Long wrote:
> On 11/26/25 9:13 AM, Michal Koutný wrote:
>> On Mon, Nov 24, 2025 at 05:30:47PM -0500, Waiman Long <llong@redhat.com> wrote:
>>> In the example above, the final configuration is A1:0-1 & B1:1-2. As the cpu
>>> lists overlap, we can't have both of them as valid partition roots. So
>>> either one of A1 or B1 is valid or they are both invalid. The current code
>>> makes them both invalid no matter the operation ordering.  This patch will

I have to admit that I prefer the current implementation.

At the very least, it ensures that all partitions are treated fairly[1]. Relaxing this rule would
make it more difficult for users to understand why the cpuset.cpus they configured do not match the
effective CPUs in use, and why different operation orders yield different results.

In another scenario, if we do not invalidate the siblings, new leaf cpusets (marked as member)
created under A1 will end up with empty effective CPUs—and this is not a desired behavior.

   root cgroup
        |
       A1
      /  \
    A2    A3...

 #1> echo "0-1" > A1/cpuset.cpus
 #2> echo "root" > A1/cpuset.cpus.partition
 #3> echo "0-1" > A2/cpuset.cpus
 #4> echo "root" > A2/cpuset.cpus.partition
 mkdir A4
 mkdir A5
 echo "0" > A4/cpuset.cpus
 echo $$ > A4/cgroup.procs
 echo "1" > A5/cpuset.cpus
 echo $$ > A5/cgroup.procs


[1]: "B1 is a second-class partition only because it starts later or why is it OK to not fulfill its
requirement?" --Michal.

>>> make one of them valid given the operation ordering above. To minimize
>>> partition invalidation, we will have to live with the fact that it will be
>>> first-come first-serve as noted by Michal. I am not against this, we just
>>> have to document it. However, the following operation order will still make
>>> both of them invalid:
>> I'm skeptical of the FCFS behavior since I'm afraid it may be subject to
>> race conditions in practice.
>> BTW should cpuset.cpus and cpuset.cpus.exclusive have different behavior
>> in this regard?
> 
> Modification to cpumasks are all serialized by the cpuset_mutex. If you are referring to 2 or more
> tasks doing parallel updates to various cpuset control files of sibling cpusets, the results can
> actually vary depending on the actual serialization results of those operations.
> 
> One difference between cpuset.cpus and cpuset.cpus.exclusive is the fact that operations on
> cpuset.cpus.exclusive can fail if the result is not exclusive WRT sibling cpusets, but becoming a
> valid partition is guaranteed unless none of the exclusive CPUs are passed down from the parent. The
> use of cpuset.cpus.exclusive is required for creating remote partition.
> 
> OTOH, changes to cpuset.cpus will never fail, but becoming a valid partition root is not guaranteed
> and is limited to the creation of local partition only.
> 
> Does that answer your question?
> 
> Cheers,
> Longman
> 

-- 
Best regards,
Ridong


  reply	other threads:[~2025-11-27  1:55 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17  1:57 [PATCH v3 0/1] cpuset: relax the overlap check for cgroup-v2 Sun Shaojie
2025-11-17  1:57 ` [PATCH v4 1/1] " Sun Shaojie
2025-11-17  7:45   ` Chen Ridong
2025-11-17 10:00     ` Sun Shaojie
2025-11-17 11:37       ` Chen Ridong
2025-11-19 10:57         ` [PATCH v5] cpuset: Avoid invalidating sibling partitions on cpuset.cpus conflict Sun Shaojie
2025-11-19 13:20           ` Michal Koutný
2025-11-20  0:57             ` Chen Ridong
2025-11-20 13:07               ` Sun Shaojie
2025-11-20 13:25                 ` Chen Ridong
2025-11-21 10:33                   ` Sun Shaojie
2025-11-22  1:19                     ` Chen Ridong
2025-11-24 10:21                       ` Sun Shaojie
2025-11-20 13:05             ` Sun Shaojie
2025-11-26 14:13               ` Michal Koutný
2025-11-27  1:57                 ` Chen Ridong
2025-12-01  9:42                 ` Sun Shaojie
2025-11-20  0:51           ` Chen Ridong
2025-11-20 13:07             ` Sun Shaojie
2025-11-20 13:45               ` Chen Ridong
2025-11-21 10:32                 ` Sun Shaojie
2025-11-22  1:33                   ` Chen Ridong
2025-11-24 10:20                     ` Sun Shaojie
2025-11-24 11:33                       ` Chen Ridong
2025-11-26 12:29                         ` Sun Shaojie
2025-11-24 22:30           ` Waiman Long
2025-11-26 12:31             ` Sun Shaojie
2025-11-26 14:13             ` Michal Koutný
2025-11-26 19:43               ` Waiman Long
2025-11-27  1:55                 ` Chen Ridong [this message]
2025-12-01  9:44                   ` Sun Shaojie
2025-12-08 14:31                     ` Michal Koutný
2025-12-10 10:11                       ` Sun Shaojie
2025-12-11 10:59                         ` Michal Koutný
2025-12-12 10:10                           ` Sun Shaojie
2025-12-13  0:52                     ` Chen Ridong
2025-12-17  9:09                       ` Sun Shaojie
2025-12-08 14:32                 ` Michal Koutný
2025-12-13  4:58                   ` Waiman Long
2025-12-01  9:38             ` [PATCH v6] " Sun Shaojie
2025-12-17  9:45               ` [PING][PATCH " Sun Shaojie
2025-12-23  6:06                 ` Waiman Long
2025-12-22 15:26               ` [PATCH " Michal Koutný
2025-12-23  6:03                 ` Waiman Long
2025-12-25  7:30               ` Waiman Long
2025-11-19 11:03         ` [PATCH v4 1/1] cpuset: relax the overlap check for cgroup-v2 Sun Shaojie
2025-11-18 17:52   ` Michal Koutný
2025-11-19 11:04     ` Sun Shaojie
2025-11-18 19:53   ` Waiman Long
2025-11-19 11:05     ` Sun Shaojie
2025-11-17  3:23 ` [PATCH v3 0/1] " Chen Ridong
2025-11-17  5:58   ` Sun Shaojie

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=45f5e2c6-42ec-4d77-9c2d-0e00472a05de@huaweicloud.com \
    --to=chenridong@huaweicloud.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=llong@redhat.com \
    --cc=mkoutny@suse.com \
    --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®