On Tue, 4 Mar 2025 19:35:02 +0100 Mateusz Guzik <mjguzik@xxxxxxxxx> 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