Test Description: Tests the behavior of shared memory when multiple threads attach to a segment with different permissions. At one stage, the reservation accounting of free hugepages allocated to parent and child's process may mess up during the memory operations.
PATCH v2 1/1 Test Description: Tests the behavior of shared memory when multiple threads attach to a segment with different permissions. At one stage, the reservation accounting of free hugepages allocated to parent and child's process may mess up during the memory operations.
Creates 4 hugepages in parent and a shared memory segment of size segment_size with 0640 permission,
The segment attaches to process address space and it is partially initialized by filling four parts of the segment with a pattern(0x55).
The segment is detached from the process's address space.
Next create child processes in a loop, Each child process reattaches to the shared memory segment as read-only by calling attach_segment() with the SHM_RDONLY flag. After attaching, the child process detaches from the segment using shmdt() and exits. If either attach or detach fails, the test fails Also if the reservation accounting calculated by comparing the free hugepage memory in parent's and child's process does not match, the test fails
The parent process waits for all the child processes to exit. If all child processes exit successfully and the reservation accounting of parent and childprocess matches then the test passes
Tested and verified the success of test case
-------
Changes in v2:
1)Make check errors are taken care
2)segment_size is not static
3)Added check to compare the free hugepage memory
-------
--- runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../mem/hugetlb/hugeshmat/hugeshmat06.c | 105 ++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat06.c
runtest/hugetlb +1 -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 +1 -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 +105 -0
105 lines not on this page · raw message
Signature · 5 lines
2.39.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp