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

From: Linus Torvalds
Date: Mon Mar 05 2007 - 19:26:42 EST




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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/