Clarify the lifetime of the return value of rte_mem_virt2iova #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Linux kernel will move memory around (changing physical address while keeping the virtual address constant) for various uses. These include compaction, autonuma, defragmentation (for future hugetlb allocations) and many more.
Because of this, one cannot depend on the physical address of any mapping to be a constant, unless a specific kernel component has pinned the physical address in place. VFIO_NOIOMMU is an example of a kernel component that does this.
Note that "mlock()" does NOT do this. mlock() guarantees that the memory will not be swapped out (hard page fault) but the kernel is allowed, and will, move memory around for defragmentation. Just using hugetlbfs is also equally not sufficient for the same reason.