Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the lifetime of the return value of rte_mem_virt2iova #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fenrus75
Copy link

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.

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.

Signed-off-by: Arjan van de Ven <[email protected]>
@tmonjalo
Copy link
Member

tmonjalo commented Jun 7, 2023

Hello, I've just noticed your pull request.
DPDK process is to send the patches to [email protected]:
git send-email --to [email protected] --cc-cmd devtools/get-maintainer.sh -1

Please could you send it there?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants