I am not that familiar with the RDMA layers but it seems that RDMA has
a library that does device driver like things right? So the logic would
best fit in there I guess.
If you combine mlock with the mmu notifier then you can actually
guarantee that a certain memory range will not be swapped out. The
notifier will then only be called if the memory range will need to be
moved for page migration, memory unplug etc etc. There may be a limit on
the percentage of memory that you can mlock in the future. This may be
done to guarantee that the VM still has memory to work with.
--