All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Waiman Long <longman@redhat.com>
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 21:08:53 +0200	[thread overview]
Message-ID: <20260929190853.GE88198@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <b8f66cbe-bb1e-4148-b2e2-55bd95f1c8d1@redhat.com>

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.

  reply	other threads:[~2026-09-29 19:09 UTC|newest]

Thread overview: 12+ 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 [this message]
2026-09-29 19:46             ` Waiman Long
2026-09-30  8:11               ` Peter Zijlstra
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=20260929190853.GE88198@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=arighi@nvidia.com \
    --cc=cgroups@vger.kernel.org \
    --cc=changwoo@igalia.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mkoutny@suse.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.