Hugetlb: Migrating libhugetlbfs shm-perms
PATCH v3 1/1 Hugetlb: Migrating libhugetlbfs shm-perms
Test Description: Tests the behavior of shared memory when multiple threads attach to a segment with different permissions.
At one point, reservation accounting of free hugepages between the parent and child processes may become inconsistent during memory operations. The parent creates 4 hugepages and a shared memory segment (size segment_size, permission 0640), attaches it, and initializes four parts with a pattern (0x55), then detaches it. Child processes are created in a loop, each reattaching the segment in read-only mode with SHM_RDONLY, detaching, and exiting. If attach/detach fails or if the reservation accounting of free hugepages doesn't match between parent and child, the test fails. If all child processes exit successfully and accounting matches, the test passes.
Tested and verified the success of test case
---
runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../mem/hugetlb/hugeshmat/hugeshmat06.c | 97 +++++++++++++++++++
3 files changed, 99 insertions(+)
create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat06.c
runtest/hugetlb +0 -0
@@ -44,6 +44,7 @@ hugeshmat02 hugeshmat02 -i 5
hugeshmat03 hugeshmat03 -i 5
hugeshmat04 hugeshmat04 -i 5
hugeshmat05 hugeshmat05 -i 5
+hugeshmat06 hugeshmat06
hugeshmctl01 hugeshmctl01 -i 5
hugeshmctl02 hugeshmctl02 -i 5
testcases/kernel/mem/.gitignore +0 -0
@@ -39,6 +39,7 @@
/hugetlb/hugeshmat/hugeshmat03
/hugetlb/hugeshmat/hugeshmat04
/hugetlb/hugeshmat/hugeshmat05
+/hugetlb/hugeshmat/hugeshmat06
/hugetlb/hugeshmctl/hugeshmctl01
/hugetlb/hugeshmctl/hugeshmctl02
/hugetlb/hugeshmctl/hugeshmctl03
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat06.c new file +97 -0
97 lines not on this page · raw message
Signature · 6 lines
2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 5 lines
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat06.c new file +4
-0+static void compare_free_hugepage_memory (long free_end,long free_start) +{ + if (free_end != free_start) + tst_res(TFAIL, "Free hugepages after attaching multiple threadsdiffer from initial allocation");
This line and couple of other lines are corrupted by the mail client you have used.
There may be some hints on how to fix that at:
https://www.kernel.org/doc/html/next/process/email-clients.html
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp