Linux cgroups development
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: Chen Ridong <chenridong@huaweicloud.com>,
	tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	lujialin4@huawei.com
Subject: Re: [PATCH -next 1/6] cpuset: add assert_cpuset_lock_held helper
Date: Wed, 17 Dec 2025 12:02:55 -0500	[thread overview]
Message-ID: <198cec94-6d2c-46c0-a46a-9ab810deb7e0@redhat.com> (raw)
In-Reply-To: <20251217084942.2666405-2-chenridong@huaweicloud.com>

On 12/17/25 3:49 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@huawei.com>
>
> Add assert_cpuset_lock_held() to allow other subsystems to verify that
> cpuset_mutex is held.

Sorry, I should have added the "lockdep_" prefix when I mentioned adding 
this helper function to be consistent with the others. Could you update 
the patch to add that?

Thanks,
Longman

>
> Suggested-by: Waiman Long <longman@redhat.com>
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
>   include/linux/cpuset.h | 2 ++
>   kernel/cgroup/cpuset.c | 5 +++++
>   2 files changed, 7 insertions(+)
>
> diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
> index a98d3330385c..af0e76d10476 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 assert_cpuset_lock_held(void);
>   extern void cpuset_cpus_allowed_locked(struct task_struct *p, struct cpumask *mask);
>   extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
>   extern bool cpuset_cpus_allowed_fallback(struct task_struct *p);
> @@ -195,6 +196,7 @@ static inline void inc_dl_tasks_cs(struct task_struct *task) { }
>   static inline void dec_dl_tasks_cs(struct task_struct *task) { }
>   static inline void cpuset_lock(void) { }
>   static inline void cpuset_unlock(void) { }
> +static inline void assert_cpuset_lock_held(void) { }
>   
>   static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
>   					struct cpumask *mask)
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index fea577b4016a..a5ad124ea1cf 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -271,6 +271,11 @@ void cpuset_unlock(void)
>   	mutex_unlock(&cpuset_mutex);
>   }
>   
> +void assert_cpuset_lock_held(void)
> +{
> +	lockdep_assert_held(&cpuset_mutex);
> +}
> +
>   /**
>    * cpuset_full_lock - Acquire full protection for cpuset modification
>    *


  reply	other threads:[~2025-12-17 17:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-17  8:49 [PATCH -next 0/6] cpuset: further separate v1 and v2 implementations Chen Ridong
2025-12-17  8:49 ` [PATCH -next 1/6] cpuset: add assert_cpuset_lock_held helper Chen Ridong
2025-12-17 17:02   ` Waiman Long [this message]
2025-12-18  0:37     ` Chen Ridong
2025-12-17  8:49 ` [PATCH -next 2/6] cpuset: add cpuset1_online_css helper for v1-specific operations Chen Ridong
2025-12-17  8:49 ` [PATCH -next 3/6] cpuset: add cpuset1_init helper for v1 initialization Chen Ridong
2025-12-17  8:49 ` [PATCH -next 4/6] cpuset: move update_domain_attr_tree to cpuset_v1.c Chen Ridong
2025-12-17 17:09   ` Waiman Long
2025-12-18  0:44     ` Chen Ridong
2025-12-18  3:06       ` Waiman Long
2025-12-17  8:49 ` [PATCH -next 5/6] cpuset: separate generate_sched_domains for v1 and v2 Chen Ridong
2025-12-17 17:48   ` Waiman Long
2025-12-18  1:28     ` Chen Ridong
2025-12-18  3:09       ` Waiman Long
2025-12-18  3:31         ` Chen Ridong
2025-12-17  8:49 ` [PATCH -next 6/6] cpuset: remove v1-specific code from generate_sched_domains Chen Ridong
2025-12-17 19:05   ` Waiman Long
2025-12-18  1:39     ` Chen Ridong
2025-12-18  3:14       ` Waiman Long
2025-12-18  3:32         ` Chen Ridong
2025-12-18  3:56     ` Chen Ridong

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=198cec94-6d2c-46c0-a46a-9ab810deb7e0@redhat.com \
    --to=llong@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huaweicloud.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lujialin4@huawei.com \
    --cc=mkoutny@suse.com \
    --cc=tj@kernel.org \
    /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