gperftools/vsprojects
Aliaksey Kandratsenka d9a99c290a expand emergency malloc integration to !kHaveGoodTLS systems
References github issue #1503.

This significantly reworks both early thread cache access and related
emergency malloc mode checking integration. As a result, we're able to
to rely on emergency malloc even on systems without "good"
TLS (e.g. QNX which does emutls).

One big change here is we're undoing early change to have single
"global" thread cache early during process lifetime. It was nice and
somewhat simpler approach. But because of inherent locking during
early process lifetime, we couldn't be sure of certain lock ordering
aspects w.r.t. backtracing/exception-stack-unwinding. So I choose to
keep it safe. So the new idea is we use SlowTLS facility to find
threads' caches when normal tls isn't ready yet. It avoids holding
locks around potentially recursion-ful things (like
ThreadCache::ModuleInit or growing heap). But we then have to be
careful to "re-attach" those early thread cache instances to regular
TLS. There will nearly always be just one of such thread caches. For
initial thread. But we cannot entirely rule out more general case
where someone creates threads before process initializers ran and
main() is reached. Another notable thing is free-ing memory in this
early mode will always using slow-path deletion directly into central
free list.

SlowTLS facility is "simply" a generalization of previous
CreateBadTLSCache code. I.e. we have a small fixed-size cache that
holds "exceptional" instances of thread-identitity to
thread-cache+emergency-mode-flag mappings.

We also take advantage of tcmalloc::kInvalidTLSKey we introduced
earlier and remove potentially raceful memory ordering between reading
tls_ready_ and tls_key_.

For emergency malloc detection we previously used thread_local
flag. Which we cannot use on !kHaveGoodTLS systems. So we instead
_remove_ thread's cache from it's normal tls storage and place it
"into" SlowTLS instead for the duration of WithStacktraceScope
call (which is how emergency mode is enabled now).
2024-05-23 13:31:42 -04:00
..
addr2line-pdb bump msvc projects to VS2019 and c++ 17 2024-01-30 15:54:24 -05:00
addressmap_unittest gtestify addressmap_unittest 2024-02-20 14:34:23 -05:00
current_allocated_bytes_test gtestify current_allocated_bytes_test 2024-02-27 17:04:53 -05:00
frag_unittest gtestify frag_unittest 2024-02-27 17:00:35 -05:00
gtest introduce vendor copy of googletest 2024-02-20 14:30:24 -05:00
include drop unused pwd.h/grp.h checks 2024-03-24 16:59:58 -04:00
libtcmalloc_minimal expand emergency malloc integration to !kHaveGoodTLS systems 2024-05-23 13:31:42 -04:00
low_level_alloc_unittest expand emergency malloc integration to !kHaveGoodTLS systems 2024-05-23 13:31:42 -04:00
malloc_extension_test gtestify malloc_extension_test 2024-03-20 16:04:37 -04:00
malloc_hook_test gtestify more tests 2024-02-20 14:34:28 -05:00
markidle_unittest gtestify markidle_unittest 2024-02-27 17:04:39 -05:00
nm-pdb bump msvc projects to VS2019 and c++ 17 2024-01-30 15:54:24 -05:00
packed-cache_test gtestify 3 simpler tests 2024-02-20 14:34:23 -05:00
page_heap_test link page_heap_test with entirety of tcmalloc_minimal 2024-02-27 17:00:35 -05:00
pagemap_unittest gtestify 3 simpler tests 2024-02-20 14:34:23 -05:00
preamble_patcher_test bump msvc projects to VS2019 and c++ 17 2024-01-30 15:54:24 -05:00
realloc_unittest gtestify realloc_unittest 2024-03-20 16:04:41 -04:00
sampler_test gtestify more tests 2024-02-20 14:34:28 -05:00
stack_trace_table_test gtestify more tests 2024-02-20 14:34:28 -05:00
system-alloc_unittest gtestify and cleanup system-alloc_unittest 2024-03-20 16:04:45 -04:00
tcmalloc_minimal_large bump msvc projects to VS2019 and c++ 17 2024-01-30 15:54:24 -05:00
tcmalloc_minimal_unittest gtestify and refactor tcmalloc_unittest 2024-03-20 16:05:14 -04:00
thread_dealloc_unittest bump msvc projects to VS2019 and c++ 17 2024-01-30 15:54:24 -05:00
common.vcxproj.props A number of cleanups 2024-01-29 17:15:53 -08:00