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

Huge pages are tricky and maybe even buggy #745

Open
jounathaen opened this issue Aug 23, 2024 · 0 comments
Open

Huge pages are tricky and maybe even buggy #745

jounathaen opened this issue Aug 23, 2024 · 0 comments

Comments

@jounathaen
Copy link
Member

I think, the current use of huge pages might have some issues.

First some background:
On Linux, there are apparently two ways of allocating huge pages:

  • Static Huge Pages: These need to be allocated at boot or via the cli before running uhyve, and there is only a limited number of them. You can check this number with cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
    • on my system, this number is actually pretty small. Far too small for proper use with more than a few MiB
  • Transparent Huge Pages: The kernel allocates pages on huge pages if possible. This is activated for a memory region with madvise.
    • Note that this does not modify previously allocated pages.
    • This relies on standard huge pages (check with cat /proc/meminfo | grep 'AnonHugePages:')

I've stumbled upon two issues:

  • mmap has no way to specify the alignment of the memory. So our MmapMemory struct cannot guarantee that the memory is located at a huge page boundary. I'm not sure if this really is an issue, but I think that it might be suboptimal to have huge pages in the vm being mapped to normal pages.
  • if the MAP_HUGETLB flag is passed to mmap, but there are no huge pages available, things just start to break without a warning. (The mmap does not fail, but accessing the memory results in SIGBUS).

Possible solutions:

@jounathaen jounathaen changed the title HugePages is tricky. HugePages are tricky and maybe even buggy Aug 23, 2024
@jounathaen jounathaen changed the title HugePages are tricky and maybe even buggy Huge pages are tricky and maybe even buggy Aug 23, 2024
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

No branches or pull requests

1 participant