Re: [patch v2] epoll use a single inode ...

Linus Torvalds
2007-03-06T00:26:14Z

On Mon, 5 Mar 2007, Davide Libenzi wrote:

> On Mon, 5 Mar 2007, Linus Torvalds wrote:
> >
> > It's much better to do something like
> >
> > static unsigned int epoll_inode;
> >
> > this.len = sprintf(name, "[%u]", ++epoll_inode);
> >
> > if you just need some pseudo-unique name to distinguish two epoll things
> > from each other (vs from a dup'ed fd).
>
> Heh, this is what Al was saying ;)
> I'm fine with that, but how about counter cycles (going back to zero)?
> Should we care to handle them correctly?

Since this is not actually *used* for anything but showing the fd's in
/proc/<pid>/fd/ etc, no. In fact, an integer will wrap a *lot* less than a
kernel data structure will be re-used, so even with the simple "wraps
every 4G uses", you're still better off.

IOW, if the thing actually _mattered_ we should use some bitmap allocator
or similar (eg pidmaps etc), but with something where the only reason
really is as a visible indicator of difference for a user that happens to
look, simple-and-stupid is better.

Linus