[lxc-devel] [PATCH 1/2] fix trivial off by one error

Christian Seiler christian at iwakd.de
Tue Sep 18 21:32:02 UTC 2012


Hi,

> Do you think mallocing an fd_set and using FD_SET() and friends
> would be better? The (dispose|finish) loops would visit FD_SETSIZE bits
> with an FD_ISSET() test, which is more work than you have currently
> with the early out, but we would probably save on the initialization
> with FD_ZERO(). I don't know if lxc_cgroup_(dispose|finish)_attach is
> performance critical.

I don't think performance is that much of an issue here, but to me it
seems that using fd_set logic would complicate things quite a bit
unnecessarily. The current logic is already a bit complicated because
the cgroup task files have to be opened before setns() but written to
only after the fork() call when we know the pid which happens after
setns(). Having a simple array with a loop over it appears to be much
more straight-forward to me, especially since iterating over an fd_set
is kind of convoluted.

> Or I can just add a comment :)

My suggestion would be to do just that unless someone has a good reason
to change the current logic.

All IMHO of course, I just wrote the initial patch, in the end other
people get to decide what goes in. ;-)

Regards,
Christian




More information about the lxc-devel mailing list