RFR: 8355627: Don't use ThreadCritical for EventLog list

Aleksey Shipilev shade at openjdk.org
Wed Apr 30 09:25:45 UTC 2025


On Tue, 29 Apr 2025 19:16:48 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Use LockFreeStack to link events on the eventLog queue.  They are never popped so this requires no further synchronization.
> Tested by tier1-4.

Not having extra locks during initialization is nice. But I am somewhat confused why we need `LockFreeStack` here. Looks like we "only" need to build the linked list of `EventLog`-s in thread-safe manner? So why don't just do our usual Atomic dance, e.g. (untested!):


EventLog::EventLog() {
  EventLog* old_head;
  do {
    old_head = Atomic::load(&Events::_logs);
    _next = old_head;
  } while (Atomic::cmpxchg(&Events::_logs, old_head, this, memory_order_relaxed) != old_head);
}

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

PR Review: https://git.openjdk.org/jdk/pull/24954#pullrequestreview-2806383175


More information about the hotspot-dev mailing list