diff options
author | dimitry <dimitry@google.com> | 2018-05-25 14:17:37 +0200 |
---|---|---|
committer | dimitry <dimitry@google.com> | 2018-05-30 10:56:59 +0200 |
commit | 55547db4345ee692b9cfe727c97dd860ed8263f8 (patch) | |
tree | 75a49563252d78140d0b60ab84e3760871c32521 /linker/linker.cpp | |
parent | d566b93091cb7a553e1d195a425d2a30f2afee3a (diff) |
Add secondary counter in place of tls_nodelete flag
The tls_nodelete state should apply to load_group not
isolated soinfo. This actually also means that multiple
soinfos may have tls_counter on their dso_handles.
This change replaces TLS_NODELETE flag with secondary counter.
Note that access to the secondary counter (located inside soinfo)
is pretty expensive because it requires soinfo lookup by dso_handle
whereas dso_handle counter is much faster. This is why it is updated
only when dso_handle counter starts or hits 0.
Bug: http://b/80278285
Test: bionic-unit-tests --gtest_filter=dl*
Change-Id: I535583f6714e45fa2a7eaf7bb3126da20ee7cba9
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 0a931c63a..12d3a78ac 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -1937,7 +1937,7 @@ void increment_dso_handle_reference_counter(void* dso_handle) { soinfo* si = find_containing_library(dso_handle); if (si != nullptr) { ProtectedDataGuard guard; - si->set_tls_nodelete(); + si->increment_ref_count(); } else { async_safe_fatal( "increment_dso_handle_reference_counter: Couldn't find soinfo by dso_handle=%p", @@ -1960,11 +1960,7 @@ void decrement_dso_handle_reference_counter(void* dso_handle) { soinfo* si = find_containing_library(dso_handle); if (si != nullptr) { ProtectedDataGuard guard; - si->unset_tls_nodelete(); - if (si->get_ref_count() == 0) { - // Perform deferred unload - note that soinfo_unload_impl does not decrement ref_count - soinfo_unload_impl(si); - } + soinfo_unload(si); } else { async_safe_fatal( "decrement_dso_handle_reference_counter: Couldn't find soinfo by dso_handle=%p", |