public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH v v2 0/4] avoid the extra atomic on a ref when closing a fd
Date: Wed, 5 Mar 2025 02:19:36 +0000	[thread overview]
Message-ID: <20250305021936.71e837ea@pumpkin> (raw)
In-Reply-To: <20250304183506.498724-1-mjguzik@gmail.com>

On Tue,  4 Mar 2025 19:35:02 +0100
Mateusz Guzik <mjguzik@gmail.com> wrote:

> The stock kernel transitioning the file to no refs held penalizes the
> caller with an extra atomic to block any increments.
> 
> For cases where the file is highly likely to be going away this is
> easily avoidable.

Have you looked at the problem caused by epoll() ?
The epoll code has a 'hidden' extra reference to the fd.
This doesn't usualy matter, but some of the driver callbacks add and
remove an extra reference - which doesn't work well if fput() has
just decremented it to zero.

The fput code might need to do a 'decrement not one' so that the
epoll tidyup can be done while the refcount is still one.

That would save the extra atomic pair that (IIRC) got added into
the epoll callback code.

Thoughts?

	David

  parent reply	other threads:[~2025-03-05  2:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 18:35 [RFC PATCH v v2 0/4] avoid the extra atomic on a ref when closing a fd Mateusz Guzik
2025-03-04 18:35 ` [PATCH v2 1/4] file: add fput and file_ref_put routines optimized for use " Mateusz Guzik
2025-03-04 18:48   ` Mateusz Guzik
2025-03-05 10:46   ` Christian Brauner
2025-03-05 12:40     ` Mateusz Guzik
2025-03-04 18:35 ` [PATCH v2 2/4] fs: use fput_close_sync() in close() Mateusz Guzik
2025-03-04 18:35 ` [PATCH v2 3/4] fs: use fput_close() in filp_close() Mateusz Guzik
2025-03-04 18:35 ` [PATCH v2 4/4] fs: use fput_close() in path_openat() Mateusz Guzik
2025-03-05  2:19 ` David Laight [this message]
2025-03-05 12:43   ` [RFC PATCH v v2 0/4] avoid the extra atomic on a ref when closing a fd Mateusz Guzik
2025-03-05 10:38 ` Christian Brauner
2025-03-05 12:42   ` Mateusz Guzik

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=20250305021936.71e837ea@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --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