RE: [PATCH v2] Implement close-on-fork

David Laight
2020-05-15T16:00:05Z

From: Eric Dumazet
> Sent: 15 May 2020 16:31
...
> Fast path in big and performance sensitive applications is not fork()
> and/or exec().
>
> This is open()/close() and others (socket(), accept(), ...)
>
> We do not want them to access extra cache lines for this new feature.
>
> Sorry, I will say no to these patches in their current form.

Is it worth completely removing the bitmaps and just remembering
the lowest fd that has had each bit set (don't worry about clears).

Then leverage the close_all() code that closes all fd above
a specified number to close only those with the 'close on exec'
or 'close on fork' flag set.

After all an application is currently very likely to have set
'close on exec' on all open fd above 2.

So the number of fd that don't need closing is small.

This puts all the expensive code in the already slow fork/exec
paths.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)