Skip to contentSkip to conversation

hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

PATCH In review Pavithra 3 participants 3 messages Sep 12 – Nov 2

lore
Share & tools
lore

Pavithra

author
#0 lore raw

PATCH v10 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.

---
v9 -> v10:
- Updated the documentation to reference :manpage:\mmap(2)``.
- Added SAFE_MUNMAP() for successful untouched mappings before closing the file descriptor.
- Replaced manual file creation and unlinking with tst_creat_unlinked(MNTPOINT, 0, 0600) in all test functions.
- Replaced manual hugetlbfs mounting and error handling with SAFE_MOUNT().
- Removed redundant hugepage-support handling because .hugepages performs the required check before setup(). Link to v9: https://lore.kernel.org/ltp/[email protected]/

---
 runtest/hugetlb                               |   1 +
 testcases/kernel/mem/.gitignore               |   1 +
 .../kernel/mem/hugetlb/hugemmap/hugemmap33.c  | 201 ++++++++++++++++++
 3 files changed, 203 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c
runtest/hugetlb +1 -0
index 621c9718a..e3ee42c2f 100644
@@ -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
index 9e706e1c8..763f134dd 100644
@@ -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 +201 -0

201 lines not on this page · raw message

Signature · 5 lines
2.55.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Pavithra,

Quoted 1 line · Pavithra

hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

Verdict - Reviewed

---
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
#2 lore raw
In reply to Pavithra

Hi!
Pushed with a minor modification, thanks.

Full diff:

testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c +4 -9
index 98a8a8a22..ed4fc44a7 100644
@@ -34,20 +34,15 @@
 static long hpage_size;
 static int quota_mounted;
 
-static void verify_quota_stat(long tot, long free, long avail)
+static void verify_quota_stat(long total, long free, long avail)
 {
        struct statfs s;
 
        SAFE_STATFS(MNTPOINT, &s);
 
-       if ((long)s.f_blocks != tot || (long)s.f_bfree != free || (long)s.f_bavail != avail) {
-               tst_res(TFAIL, "Bad quota counters: total=%li free=%li avail=%li, expected %li %li %li",
-                       (long)s.f_blocks, (long)s.f_bfree, (long)s.f_bavail,
-                       tot, free, avail);
-               return;
-       }
-       tst_res(TPASS, "Quota counters are correct: total=%li free=%li avail=%li",
-               tot, free, avail);
+       TST_EXP_EQ_LI(s.f_blocks, total);
+       TST_EXP_EQ_LI(s.f_bfree, free);
+       TST_EXP_EQ_LI(s.f_bavail, avail);
 }
 
 
Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp