From: Waiman Long <longman@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Andrea Righi" <arighi@nvidia.com>,
"Michal Koutný" <mkoutny@suse.com>, "Tejun Heo" <tj@kernel.org>,
"David Vernet" <void@manifault.com>,
"Changwoo Min" <changwoo@igalia.com>,
"Ridong Chen" <ridong.chen@linux.dev>,
"Johannes Weiner" <hannes@cmpxchg.org>,
sched-ext@lists.linux.dev, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] cgroup/cpuset: Protect is_in_v2_mode() in cpuset_num_cpus()
Date: Tue, 29 Sep 2026 15:46:23 -0400 [thread overview]
Message-ID: <500cb19a-549b-4055-a807-c3c40da787ae@redhat.com> (raw)
In-Reply-To: <20260929190853.GE88198@noisy.programming.kicks-ass.net>
On 9/29/26 3:08 PM, Peter Zijlstra wrote:
> On Tue, Sep 29, 2026 at 02:10:40PM -0400, Waiman Long wrote:
>> On 9/29/26 1:35 PM, Andrea Righi wrote:
>>>> I think it is simpler to just change is_in_v2_mode() to cpuset_v2(). Almost
>>>> all the cpuset functions should either take the callback_lock with interrupt
>>>> disabled (which is a RCU read-side critical section) or with rcu_read_lock()
>>>> and cpuset_mutex() acquired. This cpuset_num_cpus() function is an
>>>> exception. Given what is said in the comment, this function is not supposed
>>>> to be used with v1 mounted. We should change it to cpuset_v2().
>>> The comment says that, outside cgroup v2, cpuset_num_cpus() falls back to
>>> num_online_cpus(). However, on v1 with cpu and cpuset mounted together using
>>> cpuset_v2_mode, it returns the group's effective cpuset count and fair.c uses
>>> that count in the default "concur" group share calculation and in "max" mode.
>>>
>>> So replacing is_in_v2_mode() with cpuset_v2() would change scheduler behavior
>>> for that setup. I guess we could either preserve the current behavior, fix the
>>> comment and protect the root lookup with RCU; or make the code follow the
>>> documented v2-only behavior. Which one would you prefer?
>> I will let Peter decide if he wants to support the cpuset_v2_mode mount
>> option of cgroup v1 since he is the original author of cpuset_num_cpus(). If
>> this is supported, we have to update the function comment as well.
> So I was not aware of this weird mount option at all. That said, ideally
> it would work in the widest possible setting.
>
> The main constraint is going from a cpu-cgroup to a cpuset-cgroup. It
> was my understanding that this transition only works in v2, but if that
> mount option is sufficient to make that cross-cgroup transition
> meaningful, then yay I suppose.
The cpuset_v2_mode mount option is only for making the cpuset.cpus and
cpuset.mems behave like in v2. The cpu-cgroup and cpuset-cgroup can
still be in separate hierarchies. If cross-cgroup transition is the main
point, it won't work with the cpuset_v2_mode mount option. We should
switch to use cpuset_v2().
Cheers,
Longman
next prev parent reply other threads:[~2026-09-29 19:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 8:37 [PATCHSET sched_ext/for-7.4] sched_ext: Add scx_bpf_cgroup_nr_cpus() Andrea Righi
2026-09-29 8:37 ` [PATCH 1/3] cgroup/cpuset: Protect is_in_v2_mode() in cpuset_num_cpus() Andrea Righi
2026-09-29 13:47 ` Michal Koutný
2026-09-29 15:32 ` Waiman Long
2026-09-29 17:35 ` Andrea Righi
2026-09-29 18:10 ` Waiman Long
2026-09-29 19:08 ` Peter Zijlstra
2026-09-29 19:46 ` Waiman Long [this message]
2026-09-29 19:57 ` Andrea Righi
2026-09-29 8:37 ` [PATCH 2/3] sched_ext: Introduce scx_bpf_cgroup_nr_cpus() Andrea Righi
2026-09-29 8:37 ` [PATCH 3/3] selftests/sched_ext: Test scx_bpf_cgroup_nr_cpus() Andrea Righi
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=500cb19a-549b-4055-a807-c3c40da787ae@redhat.com \
--to=longman@redhat.com \
--cc=arighi@nvidia.com \
--cc=cgroups@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=ridong.chen@linux.dev \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=void@manifault.com \
/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®