[openib-general] [PATCH/RFC] libibverbs and libmthca fork support
glebn at voltaire.com
glebn at voltaire.com
Thu Aug 3 04:46:35 PDT 2006
On Wed, Aug 02, 2006 at 08:08:48AM -0700, Roland Dreier wrote:
>
> Roland> But one last call for comments: in particular, does anyone
> Roland> object to libibverbs being fork-unsafe by default unless
> Roland> ibv_fork_init is called?
>
> Gleb> I am not sure about this one. The library like MPI will have
> Gleb> to always call this anyway. On the other side if some
> Gleb> library calls fork() without application knowing it?
> Gleb> Suddenly programmer should care about such details. Perhaps
> Gleb> opt out is better the opt in and libibverbs should skip
> Gleb> ibv_fork_init() only if application ask this explicitly?
>
> But then what should libibverbs do on a kernel that doesn't support
> the required madvise(MADV_DONTFORK) call?
>
If your kernel doesn't support MADV_DONTFORK then you are SOL and I
think that what you are doing now (disabling it) is perfect. It should
be clearly documented starting from what kernel version fork() is
supported.
> It's fine if MPI calls ibv_fork_init() always -- at least then it has
> a hint about whether fork() will work.
There is nothing MPI can do with this hint. It is not going to use fork
by itself but because library never knows what application is going to
do it will have to call ibv_fork_init() just in case.
>
> Do you know if there are libraries that call fork()?
>
Honestly I can think of anything right now :) But I haven't looked at enough of
them. By the way in multi threaded program simple system() from inside the
library will be enough to screw up.
We can also provide environment variable to control libibverbs
behaviour. This way if programmer made a wrong assumption user will be
able to fix it.
--
Gleb.
More information about the general
mailing list