[crac] RFR: Persist memory in-JVM

Radim Vansa rvansa at openjdk.org
Tue Sep 5 07:06:11 UTC 2023


On Mon, 4 Sep 2023 17:32:20 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>>> just by making a snapshot of the data and comparing current state and the snapshot
>> 
>> Not sure if I follow in here; the verification could check if there's correct index entry in the loader, is that what you mean? Regrettably AFAIK it is not possible to check if given memory range is mapped with certain access modes.
>
> Regarding the quote, I mean it could be:
> 
> // _snapshot_committed - copy of _committed only to be verified during checkpoint 
> 
> void G1PageBasedVirtualSpace::persist_for_checkpoint() {
>   memcpy(_snapshot_committed, _committed, , sizeof(_snapshot_committed));
>   ... // the rest of the current impl
> }
>  
> void G1PageBasedVirtualSpace::load_on_restore() {
>    guarantee(0 == memcmp(_snapshot_committed, _committed, sizeof(_snapshot_committed),
>        "unexpected commit during checkpoint");
>  }
>  ```
>  
> And that's it -- G1PageBasedVirtualSpace just checks own invariants, an relies on MemoryPersister/Loader to load all necessary pages. This looks like as safe as the current implementation, and it could be a bit faster (no need to decide what do load here, and search that  in the index, just let Loader load everything), but the aim is to make code simpler and avoid repetitions.

We would need to allocate a new memory, get into impl details of the bitmap (`_committed._map`) etc.; I wouldn't do it in release mode for sure. Given the complexity the check seems as an overkill.

(for the record, I have no issues with restoring the memory just from the info in MemoryLoader)

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

PR Review Comment: https://git.openjdk.org/crac/pull/95#discussion_r1315458383


More information about the crac-dev mailing list