hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
PATCH v3 1/1 hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
Test hugetlbfs quota accounting with filesystem size limits to check for regressions in quota handling for MAP_PRIVATE and MAP_SHARED pages.
---
v2 -> v3:
- Remove kernel_has_private_reservations() workaround; always expect QUOTA_FAIL per LTP policy of not working around kernel bugs
- Add linux-git tag and description referencing commit a1e78772d72b
which introduced MAP_PRIVATE reservations at mmap() time
- Replace EXPECT_SUCCESS/SIGNAL/FAILURE with QUOTA_OK/FAIL/COW_FAIL
to describe expected kernel behaviour rather than exit codes
- Report TPASS/TFAIL directly in do_map() child at point of outcome instead of propagating result via exit status
- Use single hugetlbfs mount with size= on MNTPOINT directly instead
of a redundant second mount on a subdirectory
- Drop .needs_hugetlbfs; test mounts its own quota-limited instance
- Fix verify_quota_stat() to report TPASS on success
- Fix split string literal checkpatch warning
link to v2: https://lore.kernel.org/ltp/[email protected]/
--- runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../kernel/mem/hugetlb/hugemmap/hugemmap33.c | 222 ++++++++++++++++++ 3 files changed, 224 insertions(+) create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c
runtest/hugetlb +1 -0
@@ -35,6 +35,7 @@ hugemmap29 hugemmap29 hugemmap30 hugemmap30 hugemmap31 hugemmap31 hugemmap32 hugemmap32 +hugemmap33 hugemmap33 hugemmap34 hugemmap34 hugemmap35 hugemmap35 hugemmap36 hugemmap36
testcases/kernel/mem/.gitignore +1 -0
@@ -35,6 +35,7 @@ /hugetlb/hugemmap/hugemmap30 /hugetlb/hugemmap/hugemmap31 /hugetlb/hugemmap/hugemmap32 +/hugetlb/hugemmap/hugemmap33 /hugetlb/hugemmap/hugemmap34 /hugetlb/hugemmap/hugemmap35 /hugetlb/hugemmap/hugemmap36
testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c new file +222 -0
222 lines not on this page · raw message
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Pavithra,
Quoted 4 lines · Pavithra
hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
if (expected == QUOTA_FAIL && (errno == ENOMEM || errno == ENOSPC)) {
Could these checks require ENOMEM rather than also accepting ENOSPC? The documented behavior is ENOMEM, and hugetlbfs_file_mmap() deliberately returns ENOMEM when hugetlb_reserve_pages() rejects the reservation. Accepting ENOSPC here and in the COW check can hide an errno regression.
Quoted 1 line
a = mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0);
Could this and the second tested mmap() call use TESTPTR() or an appropriate TST_EXP_* wrapper? Subject syscalls should use the LTP result macros so the return value and errno are captured consistently.
Quoted 1 line
char path[PATH_MAX + 32];
Could this use PATH_MAX? LTP path buffers should use PATH_MAX rather than a custom larger size, and this constructed path is already bounded.
Quoted 1 line
+/hugetlb/hugemmap/hugemmap33
Could this entry move to testcases/kernel/mem/hugetlb/hugemmap/.gitignore? New test binaries should be ignored in their own leaf test directory rather than a parent directory.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp