RFR: 8263464: NMT: assert in gtest os.release_multi_mappings_vm [v2]

Thomas Stuefe stuefe at openjdk.org
Mon May 8 17:25:29 UTC 2023


On Mon, 8 May 2023 16:44:02 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> test/hotspot/gtest/runtime/test_os.cpp line 553:
>> 
>>> 551: }
>>> 552: #endif // !AIX
>>> 553: 
>> 
>> - This tests case B, and we need case C and D too.
>> - You should make the first - middle - release the testing release with the partwise releasing. The final release is just to clean up the mess. For that to work, the stripes must be larger and a multiple of os::allocation_granularity, since otherwise you cannot release them partwise.
>> 
>> Would be cool if you fit all of these cases into a single function, e.g. 
>> 
>> static void test_multi_release(size_t stripe_size, int num_stripes, size_t release_range_offset, size_t release_range_size)
>> 
>> 
>> And then call them 4 times in 4 tests, for each of the test cases. E.g. with a stripe len set to 1M could be like this:
>> 
>> 
>> TEST_VM(TEST_VM, release_multi_mappings_full_regions) {
>>   test_multi_release(M, 4, M, 2*M); // release stripes 2 and 3 fully
>> }
>> 
>> TEST_VM(TEST_VM, release_multi_mappings_partial_regions) {
>>   test_multi_release(M, 4, M + 512*K, 512*K + M); // release stripe 2 partly, stripe 3 fully
>> }
>> 
>> TEST_VM(TEST_VM, release_multi_mappings_partial_regions) {
>>   test_multi_release(M, 4, M, M + 512*K); // release stripe 2 fully, stripe 3 partly
>> }
>> 
>> TEST_VM(TEST_VM, release_multi_mappings_partial_regions) {
>>   test_multi_release(M, 4, M + 256K, 512 * K); // release a 512K hole into stripe 2
>> }
>
> I tried to make a picture of the memory and the parts that should get released for testing:
> 
> 
> //  allocate              [aaaa][bbbb][cccc][dddd]
> 
> //  1 release partial     [....][bbbb][....][....]
> //  2 release partial     [....][....][cccc][....]
> //  3 release partial     [....][bbbb][cccc][....]
> //  4 release partial     [....][..bb][cccc][....]
> //  5 release partial     [....][bb..][cccc][....]
> //  6 release partial     [....][bbbb][cc..][....]
> //  7 release partial     [....][bbbb][..cc][....]
> //  8 release partial     [....][..bb][cc..][....]
> //  9 release partial     [....][bb..][..cc][....]
> // 10 release partial     [....][bb..][cc..][....]
> // 11 release partial     [....][..bb][..cc][....]
> // 12 release partial     [....][.bb.][....][....]
> // 13 release partial     [....][.bb.][.cc.][....]
> 
> 
> Are we still missing any cases?
> 
> Did I add too much? (i.e. drop case 13?)

Assuming that your letters mean the release range:
- 1+2 are included in 3
- 5, 7, 9, 10, 11, 13 are all not possible with one release call, since a single os::release_memory call taks a single contiguous release range
- that leaves 3, 4, 6, 8. In other words:

   [stripe1][stripe2][strip3][stripe4]
A           xxxxxxxxxxxxxxxxx
B               xxxxxxxxxxxxx
C           xxxxxxxxxxxxx
D               xxxxxxxxx

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13813#discussion_r1187693701


More information about the hotspot-runtime-dev mailing list