[crac] RFR: Allow users to pass new properties on restore [v8]

Anton Kozlov akozlov at openjdk.java.net
Wed May 25 11:02:20 UTC 2022


On Thu, 19 May 2022 19:22:18 GMT, Ashutosh Mehra <duke at openjdk.java.net> wrote:

>> VM changes: To identify properties that can be modified on restore,
>> added a new bool field SystemProperty::_modifiable_on_restore.
>> All the jdk related properties are marked unmodifiable. Rest of the
>> properties are considered modifiable.
>> When the JVM is launched with -XX:CRaCRestoreFrom option, then the
>> properties prefixed with "-D" are maintained in a separate list in
>> Arguments::_system_properties_for_restore. This list is passed to the JVM
>> being restored by writing to a shared memory object.
>> When the JVM is restored, it reads the new properties from shared memory
>> object and updates its existing list of properties maintained in
>> Arguments::_system_properties.
>> 
>> JDK changes: System::props needs to be updated on restore to account for
>> new system properties. For this purpose j.l.System registers a new
>> JDKResource which queries new properties from the VM in afterRestore()
>> notification and updates System::props. The JDKResource registered by
>> j.l.System is given highest priority so it is the first resource to get
>> afterRestore() notification.
>> 
>> Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
>
> Ashutosh Mehra has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   Parse arguments for restore separately and perform restore early
>   
>   Also
>   - removed "modifiable" marker for system properties
>   - pass all system properties to the process being restored
>   
>   Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>

Minor comments below.

I've tried the patch with CRIU and CREngine=pauseengine and it works as expected: it's possible to set new user properties and override existing ones. Great!

src/hotspot/os/linux/os_linux.cpp line 285:

> 283: };
> 284: 
> 285: class VM_CracRestoreParameters : public CHeapObj<mtInternal> {

`VM_` prefix look like this class inherits VM_Op, but it's not. Removing the prefix would be fine.

src/hotspot/os/linux/os_linux.cpp line 308:

> 306:     _nprops(0),
> 307:     _properties(new (ResourceObj::C_HEAP, mtInternal) GrowableArray<const char *>(0, mtInternal)),
> 308:     _args(args)

This constructor apparently is not used, remove?

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

PR: https://git.openjdk.java.net/crac/pull/21


More information about the crac-dev mailing list