Feat/12168 hugepages v2 - #35
Conversation
hugepages_allocated() previously only checked that *some* hugepages were free (HugePages_Free != 0). If a user increased --suricata-hugepages on a machine that already had hugepages mounted, the new allocation request was silently ignored. Add _parse_size_to_bytes() helper and compare the currently allocated hugepage memory (HugePages_Total * Hugepagesize from /proc/meminfo) against the requested amount, re-running dpdk-hugepages.py --setup only when the mounted amount is lower. Also validate --suricata-hugepages in pytest_configure and raise a clean pytest.UsageError on invalid input (e.g. 6X or abc) instead of a raw ValueError traceback from the session fixture.
Update README.md (note after DEFAULT_HUGEPAGES, binary-search setup step) and pytest_start.sh -sh help text to describe that hugepages are re-allocated when the currently mounted amount is lower than the requested --suricata-hugepages value.
There was a problem hiding this comment.
Pull request overview
This PR refines hugepages handling in the Suricata Test Suite by making allocation decisions depend on the requested hugepage memory size (not just whether any hugepages are present) and by validating the --suricata-hugepages CLI option early for clearer error reporting.
Changes:
- Add upfront validation for
--suricata-hugepagesand a helper to parse size strings (e.g.,6G,512M) into bytes. - Update hugepage allocation detection to compare mounted hugepage memory (
HugePages_Total × Hugepagesize) against the requested amount. - Document the new behavior in the README and in
pytest_start.shhelp output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| README.md | Documents size-aware hugepages allocation behavior and clarifies setup step behavior. |
| pytest_start.sh | Updates CLI help text to reflect re-allocation behavior when mounted hugepages are below the requested amount. |
| conftest.py | Implements size parsing/validation and updates hugepage allocation gating logic to be requested-size aware. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Good to see copilot be satisfied completely for once! |
|
|
||
|
|
||
| def pytest_configure(config): | ||
| _validate_hugepages_option(config) |
There was a problem hiding this comment.
Shouldn't validation happen in the parser?
There was a problem hiding this comment.
It should not be validated in the parser, because we get a string. This string gets used in check_hugepages(). I could make the type=_parse_size_to_bytes . I could change the code further down the range to take int instead of string though if needed.
There was a problem hiding this comment.
I could make the type=_parse_size_to_bytes
That is exactly what I meant. Is there any benefit to how it is done right now?
Implements this.
Fixed a error propagation issue from v1.