From: Waiman Long <llong@redhat.com>
To: Pingfan Liu <piliu@redhat.com>, Waiman Long <llong@redhat.com>
Cc: cgroups@vger.kernel.org, Chen Ridong <chenridong@huaweicloud.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Pierre Gondois <pierre.gondois@arm.com>,
Ingo Molnar <mingo@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>,
mkoutny@suse.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv6 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked()
Date: Tue, 18 Nov 2025 09:33:53 -0500 [thread overview]
Message-ID: <45bdbbd5-9c82-4f5f-864b-9f01e356d8ef@redhat.com> (raw)
In-Reply-To: <CAF+s44SAPA+PgKBGHd_5853JOHyFxLasKXYegJSWyrkKsDYg1w@mail.gmail.com>
On 11/18/25 1:30 AM, Pingfan Liu wrote:
> On Tue, Nov 18, 2025 at 4:37 AM Waiman Long <llong@redhat.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@redhat.com>
>>> Signed-off-by: Pingfan Liu <piliu@redhat.com>
>>> Cc: Waiman Long <longman@redhat.com>
>>> Cc: Tejun Heo <tj@kernel.org>
>>> Cc: Johannes Weiner <hannes@cmpxchg.org>
>>> Cc: "Michal Koutný" <mkoutny@suse.com>
>>> Cc: linux-kernel@vger.kernel.org
>>> To: cgroups@vger.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.
That is fine too.
Cheers,
Longman
>
> Thanks,
>
> Pingfan
>
prev parent reply other threads:[~2025-11-18 14:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251117092732.16419-1-piliu@redhat.com>
2025-11-17 9:27 ` [PATCHv6 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() Pingfan Liu
2025-11-17 20:37 ` Waiman Long
2025-11-18 6:30 ` Pingfan Liu
2025-11-18 14:33 ` Waiman Long [this message]
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=45bdbbd5-9c82-4f5f-864b-9f01e356d8ef@redhat.com \
--to=llong@redhat.com \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@huaweicloud.com \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=pierre.gondois@arm.com \
--cc=piliu@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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;
as well as URLs for NNTP newsgroup(s).