[PATCH 04/17] staptree: keep embedded tag search results per thread
Aaron Merey
amerey@redhat.com
Mon Nov 23 04:14:18 GMT 2026
Constant folding looks up a tag in string_find_memoized while another
worker inserts a result into the same map. Keep a separate cache per
thread.
WARNING: ThreadSanitizer: data race
Read of size 8 at 0xffffa92035f8 by thread T18:
#9 memo_tagged_p ... staptree.cxx:358
Previous write of size 8 at 0xffffa92035f8 by thread T17:
#9 memo_tagged_p ... staptree.cxx:364
Assisted-by: Codex <noreply@openai.com>
---
staptree.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/staptree.cxx b/staptree.cxx
index 97784009c..fcebcc79b 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -352,7 +352,7 @@ string atvar_op::sym_name ()
// results.
bool memo_tagged_p (const interned_string& haystack, const string& needle)
{
- static map <pair<interned_string,string>,bool> string_find_memoized;
+ static thread_local map <pair<interned_string,string>,bool> string_find_memoized;
auto key = make_pair(haystack,needle);
auto it = string_find_memoized.find(key);
--
2.56.1
More information about the Systemtap
mailing list