JDK-8267396 : Avoid recording "pc" in unhandled oops detector for better performance
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-05-19
  • Updated: 2021-07-05
  • Resolved: 2021-05-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17
11.0.13-oracleFixed 17 b24Fixed
Related Reports
Relates :  
Description
The motivation is timeouts like JDK-8267348. Note that we are spending a significant amount of time getting pc = os::current_frame() during oop registration.

As far as I understand from the Hotspot code, that is only to print the PC when the unhandled oops detector fails _itself_:

    // If an entry is on the unhandled oop list but isn't on the stack
    // anymore, it must not have gotten unregistered properly and it's a bug
    // in the unhandled oop generator.

Since that condition must be rare, we can save considerable time not taking "pc" on every oop registration, with a minor (?) downside that we would not get the PC when unhandled oops detector is broken.

Motivational example is the test that enters the registrator path very often:

$ time CONF=linux-x86_64-server-fastdebug make run-test TEST=gc/epsilon/TestClasses.java TEST_VM_OPTS="-XX:+CheckUnhandledOops"

Before:

real	6m7.516s
user	6m38.876s
sys	0m4.566s

After:

real	2m33.344s
user	3m4.788s
sys	0m4.351s

Tier1 also improves significantly:

$ time CONF=linux-x86_64-server-fastdebug make run-test TEST=tier1 TEST_VM_OPTS="-XX:+CheckUnhandledOops"

Before:

real	60m43.022s
user	1546m54.452s
sys	45m0.769s

After:

real	42m59.204s
user	1347m41.339s
sys	50m43.837s

For the reference, the baseline without CheckUnhandledOops enabled:

$ time CONF=linux-x86_64-server-fastdebug make run-test TEST=tier1

real	32m57.509s
user	1230m5.149s
sys	54m23.135s

In other words, this cuts out about 2/3 of CheckUnhandledOops overhead.
Comments
Fix Request (11u) Improves performance under -XX:+CheckUnhandledOops. Patch applies cleanly to 11u.
05-07-2021

Changeset: f67847f5 Author: Aleksey Shipilev <shade@openjdk.org> Date: 2021-05-20 14:26:18 +0000 URL: https://git.openjdk.java.net/jdk/commit/f67847f52a306874d1a0d92250f8a556b3af6507
20-05-2021