1IBV_FORK_INIT(3) Libibverbs Programmer’s Manual IBV_FORK_INIT(3)
2
3
4
6 ibv_fork_init - initialize libibverbs to support fork()
7
9 #include <infiniband/verbs.h>
10
11 int ibv_fork_init(void);
12
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
23 ibv_fork_init() returns 0 on success, or the value of errno on failure
24 (which indicates the failure reason).
25
27 ibv_fork_init() works on Linux kernels supporting the MADV_DONTFORK
28 flag for madvise() (2.6.17 and higher).
29
30 Setting the environment variable RDMAV_FORK_SAFE or IBV_FORK_SAFE has
31 the same effect as calling ibv_fork_init().
32
33 Setting the environment variable RDMAV_HUGEPAGES_SAFE tells the library
34 to check the underlying page size used by the kernel for memory re‐
35 gions. This is required if an application uses huge pages either di‐
36 rectly or indirectly via a library such as libhugetlbfs.
37
38 Calling ibv_fork_init() will reduce performance due to an extra system
39 call for every memory registration, and the additional memory allocated
40 to track memory regions. The precise performance impact depends on the
41 workload and usually will not be significant.
42
43 Setting RDMAV_HUGEPAGES_SAFE adds further overhead to all memory regis‐
44 trations.
45
47 exec(3), fork(2), ibv_get_device_list(3), system(3), wait(2)
48
50 Dotan Barak <dotanba@gmail.com>
51
52
53
54libibverbs 2006-10-31 IBV_FORK_INIT(3)