Re: [RFC PATCH v v2 0/4] avoid the extra atomic on a ref when closing a fd

From: Mateusz Guzik
Date: Wed Mar 05 2025 - 07:44:24 EST


On Wed, Mar 5, 2025 at 3:19 AM David Laight
<david.laight.linux@xxxxxxxxx> wrote:
> 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?

I am not aware of this problem and don't have particular interest in
looking at it either, sorry.

Good thing you are free to make the case to Christian. :)
--
Mateusz Guzik <mjguzik gmail.com>