[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0ac3594-deab-455c-9c2f-495b4e4422e2@redhat.com>
Date: Wed, 13 Aug 2025 16:09:17 -0400
From: Waiman Long <llong@...hat.com>
To: Chen Ridong <chenridong@...weicloud.com>, tj@...nel.org,
hannes@...xchg.org, mkoutny@...e.com
Cc: cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
lujialin4@...wei.com, chenridong@...wei.com, christophe.jaillet@...adoo.fr
Subject: Re: [-next v2 4/4] cpuset: add helpers for cpus read and cpuset_mutex
locks
On 8/13/25 4:29 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@...wei.com>
>
> cpuset: add helpers for cpus_read_lock and cpuset_mutex
>
> Replace repetitive locking patterns with new helpers:
> - cpus_read_cpuset_lock()
> - cpus_read_cpuset_unlock()
>
> This makes the code cleaner and ensures consistent lock ordering.
>
> Signed-off-by: Chen Ridong <chenridong@...wei.com>
> ---
> kernel/cgroup/cpuset-internal.h | 2 ++
> kernel/cgroup/cpuset-v1.c | 12 +++------
> kernel/cgroup/cpuset.c | 48 +++++++++++++++------------------
> 3 files changed, 28 insertions(+), 34 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h
> index 75b3aef39231..6fb00c96044d 100644
> --- a/kernel/cgroup/cpuset-internal.h
> +++ b/kernel/cgroup/cpuset-internal.h
> @@ -276,6 +276,8 @@ int cpuset_update_flag(cpuset_flagbits_t bit, struct cpuset *cs, int turning_on)
> 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 cpus_read_cpuset_lock(void);
> +void cpus_read_cpuset_unlock(void);
The names are not intuitive. I would prefer just extend the
cpuset_lock/unlock to include cpus_read_lock/unlock and we use
cpuset_lock/unlock consistently in the cpuset code. Also, there is now
no external user of cpuset_lock/unlock, we may as well remove them from
include/linux/cpuset.h.
Cheers,
Longman
Powered by blists - more mailing lists