hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
PATCH v5 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.
---
v4 -> v5:
- split do_map() into three dedicated functions.
- Remove ACTION_COW, ACTION_TOUCH, QUOTA_OK, QUOTA_FAIL and QUOTA_COW_FAIL macros.
- Fix untouched mapping test to hold the reservation until process exit instead of calling munmap() explicitly. Link to v4: https://lore.kernel.org/ltp/[email protected]/
--- runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../kernel/mem/hugetlb/hugemmap/hugemmap33.c | 233 ++++++++++++++++++ 3 files changed, 235 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 +233 -0
233 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 8 lines · Pavithra
hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
for (b = a; b < a + size; b += hpage_size) *b = 1; tst_res(TINFO, "Testing unused quota cleanup for untouched mappings"); run_quota_test(verify_quota_ok, hpage_size, MAP_PRIVATE); verify_quota_stat(1, 1, 1);
verify_quota_ok() faults and instantiates every page, so this does not test cleanup of an untouched mapping. Use a map/unmap helper that does not access the mapping before checking the quota counters.
Quoted 5 lines
TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0));
c = TST_RET_PTR;
if (c == MAP_FAILED) {
if (TST_ERR == ENOMEM) {
tst_res(TPASS | TERRNO, "COW mmap failed as expected due to quota");No copy-on-write fault occurs because the second mapping is never accessed. This retests private mmap reservation accounting; exercise a private write that requires COW, or remove the COW claim.
Quoted 11 lines
static void
run_test(void){ tst_res(TINFO, "Testing unused quota cleanup for untouched mappings"); run_quota_test(verify_quota_ok, hpage_size, MAP_PRIVATE); ... run_quota_test(verify_quota_ok, hpage_size, MAP_PRIVATE); }static struct tst_test test = { ... .test_all = run_test,
These multiple cases are manually dispatched through .test_all. Represent them with a tcase array and use .test with .tcnt.
Quoted 1 line
+/hugetlb/hugemmap/hugemmap33
Test binaries must be ignored by a .gitignore in their own directory. Move this entry to testcases/kernel/mem/hugetlb/hugemmap/.gitignore.
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