1IBV_FORK_INIT(3)        Libibverbs Programmer’s Manual        IBV_FORK_INIT(3)
2
3
4

NAME

6       ibv_fork_init - initialize libibverbs to support fork()
7

SYNOPSIS

9              #include <infiniband/verbs.h>
10
11              int ibv_fork_init(void);
12

DESCRIPTION

14       ibv_fork_init()  initializes  libibverbs’s  data  structures  to handle
15       fork() function calls correctly  and  avoid  data  corruption,  whether
16       fork() is called explicitly or implicitly (such as in system()).
17
18       It  is not necessary to use this function if all parent process threads
19       are always blocked until all child processes end or change address spa‐
20       ces via an exec() operation.
21

RETURN VALUE

23       ibv_fork_init()  returns 0 on success, or the value of errno on failure
24       (which indicates the failure reason).  An error value of  EINVAL  indi‐
25       cates  that  there  had been RDMA memory registration already and it is
26       therefore not safe anymore to fork.
27

NOTES

29       ibv_fork_init() works on Linux  kernels  supporting  the  MADV_DONTFORK
30       flag for madvise() (2.6.17 and higher).
31
32       Setting  the  environment variable RDMAV_FORK_SAFE or IBV_FORK_SAFE has
33       the same effect as calling ibv_fork_init().
34
35       Setting the environment variable RDMAV_HUGEPAGES_SAFE tells the library
36       to  check  the  underlying  page size used by the kernel for memory re‐
37       gions.  This is required if an application uses huge pages  either  di‐
38       rectly or indirectly via a library such as libhugetlbfs.
39
40       Calling  ibv_fork_init() will reduce performance due to an extra system
41       call for every memory registration, and the additional memory allocated
42       to track memory regions.  The precise performance impact depends on the
43       workload and usually will not be significant.
44
45       Setting RDMAV_HUGEPAGES_SAFE adds further overhead to all memory regis‐
46       trations.
47

SEE ALSO

49       exec(3), fork(2), ibv_get_device_list(3), system(3), wait(2)
50

AUTHOR

52       Dotan Barak <dotanba@gmail.com>
53
54
55
56libibverbs                        2006-10-31                  IBV_FORK_INIT(3)
Impressum