OSDN Git Service

Fix __cxa_atexit run-time regression with many registrations
authorRyan Prichard <rprichard@google.com>
Fri, 9 Oct 2020 12:08:36 +0000 (05:08 -0700)
committerRyan Prichard <rprichard@google.com>
Tue, 3 Nov 2020 22:56:12 +0000 (22:56 +0000)
commit6aaff2a54df115dd12b5034d03a2c58c39e4881b
tree8c8b88e9b4669fad858c40a801761dbdb82c3bf2
parent087507107e7a5d352dbcd8bd5618b5f82bb160eb
Fix __cxa_atexit run-time regression with many registrations

When an array element is added or removed, make only the relevant page
writable, rather than the entire array. The entire array is still made
writable during recompaction and expansion.

This change fixes most of a large regression in __cxa_atexit runtime
(blueline, taskset 10, performance governor, 100000 registrations,
times are in seconds)
 - Q: _Exit=0.292380, exit=0.626801
 - R: _Exit=28.435082, exit=95.785110
 - new: _Exit=0.352285, exit=0.713893

Test: bionic unit tests
Test: adb shell taskset 10 \
  /data/benchmarktest64/bionic-spawn-benchmarks/bionic-spawn-benchmarks \
  --benchmark_filter='atexit' \
  --benchmark_display_aggregates_only=true \
  --benchmark_repetitions=10
Bug: http://b/168043760
Change-Id: I88cc15c29c9890b422b7f621f29f98a03ca1f886
Merged-In: I88cc15c29c9890b422b7f621f29f98a03ca1f886
(cherry picked from commit de523c02bbea1923ee5fbe9d1d60a905f6e965b0)
libc/bionic/atexit.cpp