cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: "Michal Koutný" <mkoutny@suse.com>,
	"Chen Ridong" <chenridong@huaweicloud.com>
Cc: tj@kernel.org, hannes@cmpxchg.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, lujialin4@huawei.com,
	chenridong@huawei.com
Subject: Re: [PATCH -next v5 3/3] cpuset: add helpers for cpus read and cpuset_mutex locks
Date: Tue, 26 Aug 2025 10:43:35 -0400	[thread overview]
Message-ID: <312f3e07-0eb9-4bdf-b5bd-24c84ef5fcc1@redhat.com> (raw)
In-Reply-To: <luegqrbloxpshm6niwre2ys3onurhttd5i3dudxbh4xzszo6bo@vqqxdtgrxxsm>


On 8/26/25 10:23 AM, Michal Koutný wrote:
> (I wrote this yesterday before merging but I'm still sending it to give
> my opinion ;-))
>
> On Mon, Aug 25, 2025 at 03:23:52AM +0000, Chen Ridong <chenridong@huaweicloud.com> wrote:
>> From: Chen Ridong <chenridong@huawei.com>
>>
>> cpuset: add helpers for cpus_read_lock and cpuset_mutex locks.
>>
>> Replace repetitive locking patterns with new helpers:
>> - cpuset_full_lock()
>> - cpuset_full_unlock()
> I don't see many precedents elsewhere in the kernel for such naming
> (like _lock and _full_lock()). Wouldn't it be more illustrative to have
> cpuset_read_lock() and cpuset_write_lock()? (As I'm looking at current
> users and your accompanying comments which could be substituted with
> the more conventional naming.)
Good naming is always an issue. Using cpuset_read_lock/cpuset_write_lock 
will be more confusing as the current locking scheme is exclusive.
> (Also if you decide going this direction, please mention commit
> 111cd11bbc548 ("sched/cpuset: Bring back cpuset_mutex") in the message
> so that it doesn't tempt to do further changes.)
>
>
>> This makes the code cleaner and ensures consistent lock ordering.
> Lock guards anyone? (When you're touching this and seeking clean code.)

Yes, I guess we can use lock guards here. You are welcome to send a 
patch to do that.

Cheers,
Longman


>
> Thanks,
> Michal


  reply	other threads:[~2025-08-26 14:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25  3:23 [PATCH -next v5 0/3] some optimization for cpuset Chen Ridong
2025-08-25  3:23 ` [PATCH -next v5 1/3] cpuset: decouple tmpmasks and cpumasks freeing in cgroup Chen Ridong
2025-08-25  3:23 ` [PATCH -next v5 2/3] cpuset: separate tmpmasks and cpuset allocation logic Chen Ridong
2025-08-25 17:37   ` Waiman Long
2025-08-25  3:23 ` [PATCH -next v5 3/3] cpuset: add helpers for cpus read and cpuset_mutex locks Chen Ridong
2025-08-26 14:23   ` Michal Koutný
2025-08-26 14:43     ` Waiman Long [this message]
2025-08-27  6:23       ` Chen Ridong
2025-08-27  8:46         ` Michal Koutný
2025-08-25 18:20 ` [PATCH -next v5 0/3] some optimization for cpuset Tejun Heo

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=312f3e07-0eb9-4bdf-b5bd-24c84ef5fcc1@redhat.com \
    --to=llong@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --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;
as well as URLs for NNTP newsgroup(s).