From 1d7cef33c5ff24695463a03c58c7ca350ec190fc Mon Sep 17 00:00:00 2001 From: Derek White Date: Sat, 20 Nov 2021 00:48:32 +0000 Subject: [PATCH] 8276662: Scalability bottleneck in SymbolTable::lookup_common() Reviewed-by: redestad, dholmes, iklam, shade --- src/hotspot/share/classfile/symbolTable.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp index fa966fc7b22..a321d94bbd2 100644 --- a/src/hotspot/share/classfile/symbolTable.cpp +++ b/src/hotspot/share/classfile/symbolTable.cpp @@ -91,7 +91,14 @@ static volatile bool _has_items_to_clean = false; static volatile bool _alt_hash = false; + +#ifdef USE_LIBRARY_BASED_TLS_ONLY static volatile bool _lookup_shared_first = false; +#else +// "_lookup_shared_first" can get highly contended with many cores if multiple threads +// are updating "lookup success history" in a global shared variable. If built-in TLS is available, use it. +static THREAD_LOCAL bool _lookup_shared_first = false; +#endif // Static arena for symbols that are not deallocated Arena* SymbolTable::_arena = NULL;