> -----Original Message-----
> From: Erez Ferber <[email protected]>
> Sent: Wednesday, May 24, 2023 3:02 PM
> To: [email protected]
> Cc: Slava Ovsiienko <[email protected]>; Matan Azrad
> <[email protected]>; Raslan Darawsheh <[email protected]>; Erez Ferber
> <[email protected]>; [email protected]
> Subject: [PATCH] common/mlx5: adjust fork call with the new kernel API
> 
> From: Erez Ferber <[email protected]>
> 
> While doing process fork() the operating system remaps all the parent
> process's memory to the address space of the child process and activates the
> Copy-on-Write mechanics - it duplicates physical pages once memory writing
> happens in the child process. Sometimes memory duplication is not allowed -
> for example, if the page contains hardware queue descriptors. To handle
> similar issues the rdma-core library should be prepared for forking.
> 
> The ibv_fork_init() prepares the library to track all the related memory and
> prevent it from forking using madvise() system API. This approach allows fork,
> but not all the memory is forked to the child process and, application should
> care not to touch pages where the parent application allocated the rdma-core
> objects.
> 
> The newer kernels propose an option of copy-on-fork for DMA pages and
> tracking all the memory and disabling it for the forking is no longer needed.
> The new API routine ibv_is_fork_initialized() should be involved to decide if
> library initialization for forking is required.
> 
> Fixes: 0e83b8e536 ("net/mlx5: move rdma-core calls to separate file")
> Cc: [email protected]
> Signed-off-by: Erez Ferber <[email protected]>
Acked-by: Viacheslav Ovsiienko <[email protected]>


Reply via email to