[master] RFR: OMWorld: Spin Changes [v4]

Axel Boldt-Christmas aboldtch at openjdk.org
Tue May 28 15:07:49 UTC 2024


> The fast lock spinning uses `sched_yield` which tends to be discouraged for spin locking code. Instead only use `SpinPause` with exponential backoff. Where after each failed CAS wait for exponentially more time until trying again in an attempt to reduce cache contention. 
> 
> This change also makes the spinning aware of safepoints, and tries to fast track the execution to next poll, which is either when successfully locked (VM backedge transition) or when going into blocked to enter the ObjectMonitor.
> 
> Have not removed `OMSpins` yet, as the exact value is not determined yet. It may have to be platform specific as `SpinPause` have different characteristics on different hardware. OMSpins is the number of fast lock, with each attempt spinning for twice as much as the last, so the total number of spins are on the order of O(2^OMSpins). It will probably land somewhere on the range of 7-14 (128 -16384 spins)

Axel Boldt-Christmas has updated the pull request incrementally with three additional commits since the last revision:

 - Add comment
 - s/responisble/responsible/
 - s/try_spin/should_spin/

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

Changes:
  - all: https://git.openjdk.org/lilliput/pull/177/files
  - new: https://git.openjdk.org/lilliput/pull/177/files/b12cc980..ae3c5b21

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=lilliput&pr=177&range=03
 - incr: https://webrevs.openjdk.org/?repo=lilliput&pr=177&range=02-03

  Stats: 7 lines in 1 file changed: 4 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/lilliput/pull/177.diff
  Fetch: git fetch https://git.openjdk.org/lilliput.git pull/177/head:pull/177

PR: https://git.openjdk.org/lilliput/pull/177


More information about the lilliput-dev mailing list