tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: reference counts on sockets?



On Wed, Sep 24, 2008 at 03:59:52PM -0400, Thor Lancelot Simon wrote:

> I have an in-kernel consumer of the socket API, which uses a very large
> number of sockets.  I don't want to maintain file structures associated
> with all these sockets unless I absolutely must -- they're wasteful, and
> kernel memory is at a premium.
> 
> The problem is that some of the code in the socket layer assumes that if
> SS_NOFDREF is set, a socket's not long for this world and can be killed
> off.  This seems like a poor substitute for a real reference counter, and
> mingles the semantics "has no associated file descriptor" and "is being
> deallocated" besides.
> 
> I'd like to add reference counts to sockets, either manipulated under
> the socket lock, or by atomic operations.  Opinions?

I think it's a good idea. I wanted to do the same along with the socket
locking but SS_NOFDREF seems a bit overloaded, so I left it.

Andrew


Home | Main Index | Thread Index | Old Index