libxlio icon indicating copy to clipboard operation
libxlio copied to clipboard

issue: 3884801 Check for resident hugepages to avoid SIGBUS

Open pasis opened this issue 6 months ago • 0 comments

Description

In a containerized environment mmap() beyond the hugepages limit can be successful, but a further memory access triggers SIGBUS and terminates the process. Check that all the allocated hugepages are resident with mincore() to avoid the SIGBUS issue.

Cost of the feature depends on the allocation size and hugepage size:

  • 32GB with 2MB pages takes 4400 us
  • 32GB with 1GB pages takes 11 us
  • 32MB with 2MB pages takes 5-6 us

We expect a big memory preallocation at the start (2GB by default) and rare 32MB allocations during warmup period. Therefore, this feature can add several additional 5us latency spikes during warmup period.

What

Check for resident hugepages after allocation.

Why ?

Avoid SIGBUS in containerized environments.

Change type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [x] Feature
  • [ ] Code style update
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Documentation content changes
  • [ ] Tests
  • [ ] Other

Check list

  • [ ] Code follows the style de facto guidelines of this project
  • [ ] Comments have been inserted in hard to understand places
  • [ ] Documentation has been updated (if necessary)
  • [ ] Test has been added (if possible)

pasis avatar Jul 29 '24 19:07 pasis