aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/win32
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-10-09 16:11:43 +0200
committerLukas Larsson <[email protected]>2018-10-23 09:58:38 +0200
commit090f9543f66cc0c4ea4d1ca63902c300b103f271 (patch)
tree70aabba756f9b6550b52d523472079b12219e0d6 /erts/emulator/sys/win32
parentd9682b02b81fa6e23e554b6e017650eb89ecebed (diff)
downloadotp-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/win32')
-rw-r--r--erts/emulator/sys/win32/erl_poll.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/erts/emulator/sys/win32/erl_poll.c b/erts/emulator/sys/win32/erl_poll.c
index 39bb4d515e..5d832f4d34 100644
--- a/erts/emulator/sys/win32/erl_poll.c
+++ b/erts/emulator/sys/win32/erl_poll.c
@@ -1017,7 +1017,8 @@ ErtsPollEvents erts_poll_control(ErtsPollSet *ps,
int erts_poll_wait(ErtsPollSet *ps,
ErtsPollResFd pr[],
- int *len)
+ int *len,
+ ErtsThrPrgrData *tpd)
{
int no_fds;
DWORD timeout = INFINITE;
@@ -1056,10 +1057,10 @@ int erts_poll_wait(ErtsPollSet *ps,
HARDDEBUGF(("Start waiting %d [%d]",num_h, (int) timeout));
ERTS_POLLSET_UNLOCK(ps);
- erts_thr_progress_prepare_wait(NULL);
+ erts_thr_progress_prepare_wait(tpd);
ERTS_MSACC_SET_STATE_CACHED(ERTS_MSACC_STATE_SLEEP);
handle = WaitForMultipleObjects(num_h, harr, FALSE, timeout);
- erts_thr_progress_finalize_wait(NULL);
+ erts_thr_progress_finalize_wait(tpd);
ERTS_MSACC_POP_STATE();
ERTS_POLLSET_LOCK(ps);
HARDDEBUGF(("Stop waiting %d [%d]",num_h, (int) timeout));