RFR: 8369622: GlobalChunkPoolMutex needs to be recursive

Kim Barrett kbarrett at openjdk.org
Tue Oct 14 13:33:42 UTC 2025


On Mon, 13 Oct 2025 06:39:56 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> The GlobalChunkPoolMutex replaced ThreadCritical in [JDK-8356173](https://bugs.openjdk.org/browse/JDK-8356173). In NMT, we can unfortunately reach a recursive locking situation in situations when the VM is crashing and NMT attempts to perform a error report. I suggest that we make this particular mutex recursive, until we can resolve the design issues that causes this.
>> 
>> This PR also replaces the static initialization with `DeferredStatic`, and fixes the indentation of access modifiers to be consistently 0-indented.
>> 
>> Please note that we do not take the lock in NMT in order to allocate memory, but in order to have a "static picture" of the arena counters.
>
> src/hotspot/share/memory/arena.cpp line 250:
> 
>> 248:   static const int cleaning_interval = 5000; // cleaning interval in ms
>> 249: 
>> 250: public:
> 
> The style guide doesn't mention this but I thought the unofficial preference was for one character indent so that we don't have lines at the same level as the outermost class definition.

The style guide doesn't mention it because I don't think we have consistent
usage, and I haven't felt like stirring that pot. (Others are, of course, free
to do so.) Personally I use no-indent unless the surrounding code uses
1sp-indent. And only change an existing 1sp-indent to no-indent if it seems
out of place compared to surrounding code and I happen to be touching
something nearby.  (switch/case labels are similarly inconsistent in our code.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27759#discussion_r2429199234


More information about the hotspot-runtime-dev mailing list