[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAF+s44SAPA+PgKBGHd_5853JOHyFxLasKXYegJSWyrkKsDYg1w@mail.gmail.com>
Date: Tue, 18 Nov 2025 14:30:42 +0800
From: Pingfan Liu <piliu@...hat.com>
To: Waiman Long <llong@...hat.com>
Cc: cgroups@...r.kernel.org, Chen Ridong <chenridong@...weicloud.com>,
Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
Pierre Gondois <pierre.gondois@....com>, Ingo Molnar <mingo@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>, Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>, mkoutny@...e.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv6 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked()
On Tue, Nov 18, 2025 at 4:37 AM Waiman Long <llong@...hat.com> wrote:
>
> On 11/17/25 4:27 AM, Pingfan Liu wrote:
> > cpuset_cpus_allowed() uses a reader lock that is sleepable under RT,
> > which means it cannot be called inside raw_spin_lock_t context.
> >
> > Introduce a new cpuset_cpus_allowed_locked() helper that performs the
> > same function as cpuset_cpus_allowed() except that the caller must have
> > acquired the cpuset_mutex so that no further locking will be needed.
> >
> > Suggested-by: Waiman Long <longman@...hat.com>
> > Signed-off-by: Pingfan Liu <piliu@...hat.com>
> > Cc: Waiman Long <longman@...hat.com>
> > Cc: Tejun Heo <tj@...nel.org>
> > Cc: Johannes Weiner <hannes@...xchg.org>
> > Cc: "Michal Koutný" <mkoutny@...e.com>
> > Cc: linux-kernel@...r.kernel.org
> > To: cgroups@...r.kernel.org
> > ---
> > include/linux/cpuset.h | 1 +
> > kernel/cgroup/cpuset.c | 51 +++++++++++++++++++++++++++++-------------
> > 2 files changed, 37 insertions(+), 15 deletions(-)
> >
> > diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
> > index 2ddb256187b51..e057a3123791e 100644
> > --- a/include/linux/cpuset.h
> > +++ b/include/linux/cpuset.h
> > @@ -75,6 +75,7 @@ extern void dec_dl_tasks_cs(struct task_struct *task);
> > extern void cpuset_lock(void);
> > extern void cpuset_unlock(void);
> > extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
> > +extern void cpuset_cpus_allowed_locked(struct task_struct *p, struct cpumask *mask);
> > extern bool cpuset_cpus_allowed_fallback(struct task_struct *p);
> > extern bool cpuset_cpu_is_isolated(int cpu);
> > extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
>
> Ah, the following code should be added to to !CONFIG_CPUSETS section
> after cpuset_cpus_allowed().
>
> #define cpuset_cpus_allowed_locked(p, m) cpuset_cpus_allowed(p, m)
>
> Or you can add another inline function that just calls
> cpuset_cpus_allowed().
>
It may be better to make cpuset_cpus_allowed() call
cpuset_cpus_allowed_locked(), following the call chain used under
CONFIG_CPUSETS case.
Thanks,
Pingfan
Powered by blists - more mailing lists