RFR: JDK-8260332: ParallelGC: Cooperative pretouch for oldgen expansion [v2]
Amit Pawar
github.com+71302734+amitdpawar at openjdk.java.net
Wed Apr 7 15:42:35 UTC 2021
On Mon, 5 Apr 2021 20:07:00 GMT, Amit Pawar <github.com+71302734+amitdpawar at openjdk.org> wrote:
>>> > > [PreTouchParallelChunkSize_TestResults_UpdatedForOldGenCase.xlsx](https://github.com/openjdk/jdk/files/6147180/PreTouchParallelChunkSize_TestResults_UpdatedForOldGenCase.xlsx)
>>> >
>>> >
>>> > I'm not sure how to interpret this. In particular, it says "Test done using November 27rd Openjdk build". That predates a number of recent changes in this area that seem relevant. Is that correct? Or is that stale and the data has been updated for a newer baseline.
>>>
>>> Sorry for the confusion. I didnt test again and pre-touch time taken with different chunk size per thread was already recorded in the spreadsheet and thought to use it for reference to reply to David feedback "A change like this needs a lot more testing than that, both functionally and performance.".
>>
>> Getting any benefit from parallel pretouch here suggests we have many threads piling up on the expand mutex. Before JDK-8260045 (pushed together with JDK-8260044 on 2/12/2021) that would lead to "expansion storms", where several threads piled up on that mutex and serially entered and did a new expansion (with associated pretouch, and possibly of significant size). Getting rid of the expansion storms may alleviate the serial pretouch quite a bit. There may still be some benefit to cooperative parallization, but new measurements are needed to determine how much of a problem still exists.
>>
>> If it is still worth addressing, I think the proposed approach has problems, as it makes messy complicated code messier and more complicated. I think some preliminary refactoring is needed. For example, splitting MutableSpace::initialize into a setup-pages part and set-the-range part. I've not explored in detail what's needed yet, pending new measurements. (I haven't had time to do those measurements yet myself.)
>
> Thanks Kim for your feedback.
>
> I have updated the code and it looks good now. Please use "Full" diff to see all the changes.
>
> Summary of changes: added new class in pretouchTask.hpp file for synchronization. Now co-operative pretouch is enabled for both ParallelGC and G1GC. For testing purpose, added new flag "UseMultithreadedPretouchForOldGen" and timing is enabled for old-gen pretouch case for measurements. Enabling this flag makes try_lock to be used instead of lock (which is current default).
>
> This change will be useful only if PreTouchParallelChunkSize value is not very huge compared to old-gen expansion size. For Linux it is set to 4MB and for other OS it is still 1GB.
>
> Testing SPECJbb composite on AMD EPYC machine shows following improvement.
>
> - Parallel GC: with UseNUMA, minimum expansion size is 64MB
> -- with 2MB hugepages, master branch time taken is ~9-10ms and current fix time taken is ~1-2ms`
> -- without hugepages, master branch time taken is ~14-17ms and current fix time taken is ~2-3ms
>
> - Parallel GC: without UseNUMA, minimum expansion size is 512KB so this change is not useful for this size. Sometime expansion goes upto 20MB then pretouch takes less time for such large size.
>
> - G1 GC: with UseNUMA, maximum expansion size is 32MB
> -- with 2MB hugepages, master branch time taken is ~5-7ms and current fix time taken is ~1-7ms` (higher time due to single thread activity as there was no other thread waiting to acquire the lock)
>
> - G1 GC: without UseNUMA, minimum expansion size 64KB and maximum expansion size is 32MB
> -- without hugepages, master branch time taken = ~9-11ms and current fix time taken ~2-9ms (same here too)
>
> Please check.
Fixing runtime issue seen in Pre-submit tests. I somehow missed no safepoint check while acquiring the lock in G1 case. Minor issue. Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2976
More information about the hotspot-dev
mailing list