diff options
author | Lukas Larsson <[email protected]> | 2018-10-09 16:11:43 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2018-10-23 09:58:38 +0200 |
commit | 090f9543f66cc0c4ea4d1ca63902c300b103f271 (patch) | |
tree | 70aabba756f9b6550b52d523472079b12219e0d6 /erts/emulator/sys/common/erl_check_io.c | |
parent | d9682b02b81fa6e23e554b6e017650eb89ecebed (diff) | |
download | otp-090f9543f66cc0c4ea4d1ca63902c300b103f271.tar.gz otp-090f9543f66cc0c4ea4d1ca63902c300b103f271.tar.bz2 otp-090f9543f66cc0c4ea4d1ca63902c300b103f271.zip |
erts: Pass thread progress data where possible
The poll thread does a lot of waking up and then going
back to sleep. A large part of the waking up is managing
thread progress and a large part of that was using thread
specific data to get the thread progress data pointer.
With this refactor the tpd is passed to each of the functions
which greatly decreases the number of ethr_get_tsd calls
which in turn halves the CPU usage of the poller thread in
certain scenarios.
Diffstat (limited to 'erts/emulator/sys/common/erl_check_io.c')
-rw-r--r-- | erts/emulator/sys/common/erl_check_io.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/emulator/sys/common/erl_check_io.c b/erts/emulator/sys/common/erl_check_io.c index 9f115706dc..748555165f 100644 --- a/erts/emulator/sys/common/erl_check_io.c +++ b/erts/emulator/sys/common/erl_check_io.c @@ -105,6 +105,7 @@ typedef struct erts_poll_thread { ErtsPollSet *ps; ErtsPollResFd *pollres; + ErtsThrPrgrData *tpd; int pollres_len; } ErtsPollThread; @@ -1516,7 +1517,8 @@ erts_check_io_interrupt(ErtsPollThread *psi, int set) } ErtsPollThread * -erts_create_pollset_thread(int id) { +erts_create_pollset_thread(int id, ErtsThrPrgrData *tpd) { + psiv[id].tpd = tpd; return psiv+id; } @@ -1538,12 +1540,12 @@ erts_check_io(ErtsPollThread *psi) #if ERTS_POLL_USE_FALLBACK if (psi->ps == get_fallback()) { - poll_ret = erts_poll_wait_flbk(psi->ps, psi->pollres, &pollres_len); + poll_ret = erts_poll_wait_flbk(psi->ps, psi->pollres, &pollres_len, psi->tpd); } else #endif { - poll_ret = erts_poll_wait(psi->ps, psi->pollres, &pollres_len); + poll_ret = erts_poll_wait(psi->ps, psi->pollres, &pollres_len, psi->tpd); } #ifdef ERTS_ENABLE_LOCK_CHECK |