mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 14:00:30 +00:00
15a0c5730d
This second patch contains the actual implementation of a new sorting algorithm for shared objects in the dynamic loader, which solves the slow behavior that the current "old" algorithm falls into when the DSO set contains circular dependencies. The new algorithm implemented here is simply depth-first search (DFS) to obtain the Reverse-Post Order (RPO) sequence, a topological sort. A new l_visited:1 bitfield is added to struct link_map to more elegantly facilitate such a search. The DFS algorithm is applied to the input maps[nmap-1] backwards towards maps[0]. This has the effect of a more "shallow" recursion depth in general since the input is in BFS. Also, when combined with the natural order of processing l_initfini[] at each node, this creates a resulting output sorting closer to the intuitive "left-to-right" order in most cases. Another notable implementation adjustment related to this _dl_sort_maps change is the removing of two char arrays 'used' and 'done' in _dl_close_worker to represent two per-map attributes. This has been changed to simply use two new bit-fields l_map_used:1, l_map_done:1 added to struct link_map. This also allows discarding the clunky 'used' array sorting that _dl_sort_maps had to sometimes do along the way. Tunable support for switching between different sorting algorithms at runtime is also added. A new tunable 'glibc.rtld.dynamic_sort' with current valid values 1 (old algorithm) and 2 (new DFS algorithm) has been added. At time of commit of this patch, the default setting is 1 (old algorithm). Signed-off-by: Chung-Lin Tang <cltang@codesourcery.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
16 lines
771 B
Plaintext
16 lines
771 B
Plaintext
glibc.malloc.arena_max: 0x0 (min: 0x1, max: 0x[f]+)
|
|
glibc.malloc.arena_test: 0x0 (min: 0x1, max: 0x[f]+)
|
|
glibc.malloc.check: 0 (min: 0, max: 3)
|
|
glibc.malloc.mmap_max: 0 (min: 0, max: 2147483647)
|
|
glibc.malloc.mmap_threshold: 0x0 (min: 0x0, max: 0x[f]+)
|
|
glibc.malloc.mxfast: 0x0 (min: 0x0, max: 0x[f]+)
|
|
glibc.malloc.perturb: 0 (min: 0, max: 255)
|
|
glibc.malloc.tcache_count: 0x0 (min: 0x0, max: 0x[f]+)
|
|
glibc.malloc.tcache_max: 0x0 (min: 0x0, max: 0x[f]+)
|
|
glibc.malloc.tcache_unsorted_limit: 0x0 (min: 0x0, max: 0x[f]+)
|
|
glibc.malloc.top_pad: 0x0 (min: 0x0, max: 0x[f]+)
|
|
glibc.malloc.trim_threshold: 0x0 (min: 0x0, max: 0x[f]+)
|
|
glibc.rtld.dynamic_sort: 1 (min: 1, max: 2)
|
|
glibc.rtld.nns: 0x4 (min: 0x1, max: 0x10)
|
|
glibc.rtld.optional_static_tls: 0x200 (min: 0x0, max: 0x[f]+)
|