From: "Bence Csókás" <bence.csokas@arm.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 0/2] Add scope-based cleanup capability to eventfd_ctx
Date: Fri, 6 Nov 2026 10:31:58 +0100 [thread overview]
Message-ID: <bba04255-5dee-4dd2-a877-5e169edceadc@arm.com> (raw)
In-Reply-To: <20261106-hinein-lagebericht-abbezahlen-cb826d68d175@brauner>
Hi,
On 2026. 11. 06. 10:05, Christian Brauner wrote:
> On Tue, Oct 27, 2026 at 05:22:00PM +0100, Bence Csokas wrote:
>> Add __free() support to eventfd and update drm_syncobj to use it as an
>> example consumer.
>>
>> A minor discrepancy I encountered is whether to put a semicolon after
>> DEFINE_FREE(). It seems some in-tree code does, some doesn't. In the end,
>> I followed the example set in core-api/cleanup.rst, and omitted it.
>>
>> Signed-off-by: Bence Csokas <bence.csokas@arm.com>
>> ---
>
> I'm really having trouble seeing how this improves anything
> significantly. Probably others have the same impression which is why
> this doesn't get a lot of review.
The goal of the __free() API is to reduce the number of goto-based error
paths. Normally, you'd have to keep the state of every local in your
head for every early return. (Has it been initialized? Has it been
consumed? Or does it need to be freed?) Then you need to arrange your
"goto tree" (error labels) in a way that frees everything, and then for
every early exit, jump to the correct one. This can be quite complex for
some functions. Look at KVM or HyperV eventfd code, for example.
By contrast, you just mark the local var with _free() and an appropriate
destructor snippet, and the consumption point (the point after which we
don't need to free it on a return) with no_free_ptr(), and the compiler
instruments every early return accordingly.
Bence
next prev parent reply other threads:[~2026-11-06 9:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 16:22 Bence Csokas
2026-10-27 16:22 ` [PATCH v3 1/2] eventfd: Add scope-based cleanup capability Bence Csokas
2026-10-27 16:22 ` [PATCH v3 2/2] drm/syncobj: Use scope-based cleanup for eventfd_ctx Bence Csokas
2026-11-06 9:05 ` [PATCH v3 0/2] Add scope-based cleanup capability to eventfd_ctx Christian Brauner
2026-11-06 9:31 ` Bence Csókás [this message]
2026-11-06 14:13 ` Jan Kara
2026-11-06 14:30 ` Bence Csókás
2026-11-06 15:02 ` Jan Kara
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=bba04255-5dee-4dd2-a877-5e169edceadc@arm.com \
--to=bence.csokas@arm.com \
--cc=airlied@gmail.com \
--cc=brauner@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®