From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: chenridong@huaweicloud.com
Cc: bsegall@google.com, cgroups@vger.kernel.org,
chenridong@huawei.com, dietmar.eggemann@arm.com,
hannes@cmpxchg.org, juri.lelli@redhat.com,
linux-kernel@vger.kernel.org, longman@redhat.com,
lujialin4@huawei.com, mgorman@suse.de, mingo@redhat.com,
mkoutny@suse.com, peterz@infradead.org, rostedt@goodmis.org,
tj@kernel.org, vincent.guittot@linaro.org, vschneid@redhat.com
Subject: Re: [PATCH -next 2/4] cpuset: add helpers for cpuset related locks
Date: Sat, 9 Aug 2025 17:56:49 +0200 [thread overview]
Message-ID: <30dd9cb7-8471-400e-b293-a1a52921a5f3@wanadoo.fr> (raw)
In-Reply-To: <20250808092515.764820-3-chenridong@huaweicloud.com>
Le 08/08/2025 à 11:25, Chen Ridong a écrit :
> From: Chen Ridong <chenridong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>
> Add guard_cpus_read_and_cpuset and guard_cpuset helpers for cpuset, which
> will be user for subsequent patched to make code concise;
>
> Signed-off-by: Chen Ridong <chenridong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> include/linux/cpuset.h | 1 +
> kernel/cgroup/cpuset-internal.h | 2 ++
> kernel/cgroup/cpuset.c | 11 +++++++++++
> 3 files changed, 14 insertions(+)
>
> diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
> index 2ddb256187b5..6153de28acf0 100644
> --- a/include/linux/cpuset.h
> +++ b/include/linux/cpuset.h
> @@ -74,6 +74,7 @@ extern void inc_dl_tasks_cs(struct task_struct *task);
> extern void dec_dl_tasks_cs(struct task_struct *task);
> extern void cpuset_lock(void);
> extern void cpuset_unlock(void);
> +extern void guard_cpuset(void);
> extern void cpuset_cpus_allowed(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);
> diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h
> index 75b3aef39231..084e19fe33d5 100644
> --- a/kernel/cgroup/cpuset-internal.h
> +++ b/kernel/cgroup/cpuset-internal.h
> @@ -277,6 +277,8 @@ ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
> char *buf, size_t nbytes, loff_t off);
> int cpuset_common_seq_show(struct seq_file *sf, void *v);
>
> +void guard_cpus_read_and_cpuset(void);
> +
> /*
> * cpuset-v1.c
> */
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index cf7cd2255265..f6cdb5cdffe8 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -260,6 +260,17 @@ void cpuset_unlock(void)
> mutex_unlock(&cpuset_mutex);
> }
>
> +void guard_cpuset(void)
> +{
> + guard(mutex)(&cpuset_mutex);
> +}
> +
> +void guard_cpus_read_and_cpuset(void)
> +{
> + guard(cpus_read_lock)();
> + guard(mutex)(&cpuset_mutex);
> +}
> +
Not sure that it works like that.
I think that these 2 functions are just no-op because whatever is
"garded", it will be release when the function exits.
So, if correct, all this serie does is removing some existing
synchronisation mechanism.
Do I miss something obvious?
CJ
> static DEFINE_SPINLOCK(callback_lock);
>
> void cpuset_callback_lock_irq(void)
next prev parent reply other threads:[~2025-08-09 16:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 9:25 [PATCH -next 0/4] some optimization for cpuset Chen Ridong
2025-08-08 9:25 ` [PATCH -next 1/4] cpuset: remove redundant CS_ONLINE flag Chen Ridong
2025-08-12 14:44 ` Waiman Long
2025-08-13 0:54 ` Chen Ridong
2025-08-13 1:00 ` Waiman Long
2025-08-13 1:20 ` Chen Ridong
2025-08-13 1:33 ` Waiman Long
2025-08-13 6:28 ` Chen Ridong
2025-08-08 9:25 ` [PATCH -next 2/4] cpuset: add helpers for cpuset related locks Chen Ridong
2025-08-09 15:56 ` Christophe JAILLET [this message]
2025-08-11 2:17 ` Chen Ridong
2025-08-08 9:25 ` [PATCH -next 3/4] cpuset: use guard_cpus_read_and_cpuset to make code concise Chen Ridong
2025-08-08 9:25 ` [PATCH -next 4/4] cpuset: replace cpuset_lock() with guard_cpuset() Chen Ridong
2025-08-08 22:02 ` kernel test robot
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=30dd9cb7-8471-400e-b293-a1a52921a5f3@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@huawei.com \
--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=longman@redhat.com \
--cc=lujialin4@huawei.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--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).