ibv_advise_mr - Gives advice or directions to the kernel about an address range belongs to a memory region (MR).
#include <infiniband/verbs.h> int ibv_advise_mr(struct ibv_pd *pd, enum ibv_advise_mr_advice advice, uint32_t flags, struct ibv_sge *sg_list, uint32_t num_sge)
ibv_advise_mr() Give advice or directions to the kernel about an address range belonging to a memory region (MR). Applications that are aware of future access patterns can use this verb in order to leverage this knowledge to improve system or application performance.
Conventional advice values
ibv_advise_mr() returns 0 when the call was successful, or the value of errno on failure (which indicates the failure reason).
An application may pre-fetch any address range within an ODP MR when using the IBV_ADVISE_MR_ADVICE_PREFETCH or IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE advice. Semantically, this operation is best-effort. That means the kernel does not guarantee that underlying pages are updated in the HCA or the pre-fetched pages would remain resident.
When using IBV_ADVISE_MR_ADVICE_PREFETCH or IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE advice, the operation will be done in the following stages: o Page in the user pages to memory (pages aren't pinned). o Get the dma mapping of these user pages. o Post the underlying page translations to the HCA.
If IBV_ADVISE_MR_FLAG_FLUSH is specified then the underlying pages are guaranteed to be updated in the HCA before returning SUCCESS. Otherwise the driver can choose to postpone the posting of the new translations to the HCA. When performing a local RDMA access operation it is recommended to use IBV_ADVISE_MR_FLAG_FLUSH flag with one of the pre-fetch advices to increase probability that the pages translations are valid in the HCA and avoid future page faults.
ibv_reg_mr(3), ibv_rereg_mr(3), ibv_dereg_mr(3)
Aviad Yehezkel <aviadye@mellanox.com>