On Sat, Nov 25, 2023 at 08:59:54PM -0800, Linus Torvalds wrote: > On Sat, 25 Nov 2023 at 18:08, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > > > However, all of that can be achieved easier - all it takes is fput() > > recognizing that case and calling file_free() directly. > > No need to introduce a special primitive for that - and things like > > failing dentry_open() could benefit from that as well. > > > > Objections? > > Ack, looks fine. > > In fact, I did suggest something along the lines at the time: > > https://lore.kernel.org/all/CAHk-=whLadznjNKZPYUjxVzAyCH-rRhb24_KaGegKT9E6A86Kg@xxxxxxxxxxxxxx/ > > although yours is simpler, because I for some reason (probably looking > at Mateusz' original patch too much) re-implemented file_free() as > fput_immediate().. file_free() was with RCU delay at that time, IIRC. I don't think that cost of one test and (rarely) branch on each final fput() is going to be measurable. Mateusz, do you still have the setup you used for the original patch? Could you profile and compare the current tree and current tree + the patch upthread?