From: Jemmy Wong <jemmywong512@gmail.com>
To: "Michal Koutný" <mkoutny@suse.com>, tj@kernel.org, hannes@cmpxchg.org
Cc: Jemmy <jemmywong512@gmail.com>, Waiman Long <longman@redhat.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 0/3] cgroup: Add lock guard support
Date: Fri, 20 Jun 2025 18:45:54 +0800 [thread overview]
Message-ID: <9BDD726A-2EAE-46C3-9D00-004E051B8F5B@gmail.com> (raw)
In-Reply-To: <2dd7rwkxuirjqpxzdvplt26vgfydomu56j3dkmr37765zk67pd@aou7jw4d6wtq>
Hi Michal, Tejun, Johannes,
Thank you, Michal, for supporting this modernization effort to adopt guard constructs.
With 3,326 instances already in use across the kernel upstream,
guards offer improved safety and readability.
I look forward to working with the community to integrate them into cgroup
and welcome feedback to ensure a smooth transition.
Best,
Jemmy
> On Jun 17, 2025, at 5:08 PM, Michal Koutný <mkoutny@suse.com> wrote:
>
> Hello.
>
> I understand why this might have been controversial but I'm surprised it
> remains so when the lock guards are already used in the kernel code.
> Documentation/process/coding-style.rst isn't partisan in either way.
>
> Johannes:
>> heebeejeebees - it's asymmetric and critical sections don't stand out
>> visually at all.
> - I'd say that's the point of it for functions that are made to
> manipulate data structures under the lock. Not to spoil the code.
> - Yes, it's a different coding style that one has to get used to.
>
>> extra indentation
> - deeper indentation == deeper locking, wary of that
> - although I admit, in some cases of the reworked code, it's overly deep
>
> Further reasoning is laid out in include/linux/cleanup.h. I noticed
> there exists no_free_ptr() macro and that suggests an idea for analogous
> no_exit_class() (or unguard()) macro (essential an unlock + signal for
> compiler to not call cleanup function after this BB).
>
> Tejun:
>> There are no practical benefits to converting the code base at this point.
>
> I'd expect future backports (into such code) to be more robust wrt
> pairing errors.
> At the same time this is also my biggest concern about this change, the
> wide-spread diff would make current backporting more difficult. (But
> I'd counter argue that one should think forward here.)
>
>
> Further benefits I see:
> - it is fewer lines (code is to the point),
> - reliable cleanup paths,
> - it is modern and evolution step forward (given such constructs
> eventually emerge in various languages).
>
>
> On Sat, Jun 07, 2025 at 12:18:38AM +0800, Jemmy Wong <jemmywong512@gmail.com> wrote:
>> v1 changes:
>> - remove guard support for BPF
>> - split patch into parts
>>
>> v0 link:
>> https://lore.kernel.org/all/20250605211053.19200-1-jemmywong512@gmail.com/
>>
>> Jemmy Wong (3):
>> cgroup: add lock guard support for cgroup_muetx
>> cgroup: add lock guard support for css_set_lock and rcu
>> cgroup: add lock guard support for others
>
> As for the series in general
> - I'm still in favor of pursuing it (with remarks to individual
> patches),
> - it's a good opportunity to also to append sparse __acquires/__releases
> cleanup to it (see also [1]).
>
> Regards,
> Michal
>
> [1] https://lore.kernel.org/r/Z_6z2-qqLI7dbl8h@slm.duckdns.org
>
next prev parent reply other threads:[~2025-06-20 10:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 16:18 [PATCH v1 0/3] cgroup: Add lock guard support Jemmy Wong
2025-06-06 16:18 ` [PATCH v1 1/3] cgroup: add lock guard support for cgroup_muetx Jemmy Wong
2025-06-17 9:09 ` Michal Koutný
2025-06-06 16:18 ` [PATCH v1 2/3] cgroup: add lock guard support for css_set_lock and rcu Jemmy Wong
2025-06-17 9:09 ` Michal Koutný
2025-06-06 16:18 ` [PATCH v1 3/3] cgroup: add lock guard support for others Jemmy Wong
2025-06-07 10:50 ` kernel test robot
2025-06-08 8:52 ` Jemmy Wong
2025-06-17 9:10 ` Michal Koutný
2025-06-09 16:34 ` [PATCH v1 0/3] cgroup: Add lock guard support Tejun Heo
2025-06-17 9:08 ` Michal Koutný
2025-06-20 10:45 ` Jemmy Wong [this message]
2025-06-21 2:52 ` Tejun Heo
2025-06-23 14:03 ` Johannes Weiner
2025-06-30 17:39 ` Michal Koutný
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=9BDD726A-2EAE-46C3-9D00-004E051B8F5B@gmail.com \
--to=jemmywong512@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.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).