Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
4131-erts-Refactor-dirty_refc-in-ErtsSignalInQu...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4131-erts-Refactor-dirty_refc-in-ErtsSignalInQueueBufferA.patch of Package erlang
From 2b86199db8cd2d03f4ffcf1cad227e55eebfb591 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Mon, 27 Jun 2022 19:13:42 +0200 Subject: [PATCH 1/4] erts: Refactor dirty_refc in ErtsSignalInQueueBufferArray No need for 64 bits on 32-bit arch. Can only be +1 per unmanaged thread. No need for full memory barriers (what I can see). --- erts/emulator/beam/erl_message.h | 2 +- erts/emulator/beam/erl_proc_sig_queue.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erts/emulator/beam/erl_message.h b/erts/emulator/beam/erl_message.h index 87cd96f4cd..afb2c7ca94 100644 --- a/erts/emulator/beam/erl_message.h +++ b/erts/emulator/beam/erl_message.h @@ -416,7 +416,7 @@ typedef struct { * the buffer array. This is needed since dirty schedulers are not * part of the thread progress system. */ - erts_atomic64_t dirty_refc; + erts_refc_t dirty_refc; Uint nr_of_rounds; Uint nr_of_enqueues; int alive; diff --git a/erts/emulator/beam/erl_proc_sig_queue.c b/erts/emulator/beam/erl_proc_sig_queue.c index 0af9bf6818..37fbfc579f 100644 --- a/erts/emulator/beam/erl_proc_sig_queue.c +++ b/erts/emulator/beam/erl_proc_sig_queue.c @@ -8462,7 +8462,7 @@ void erts_proc_sig_queue_maybe_install_buffers(Process* p, erts_aint32_t state) sizeof(ErtsSignalInQueueBufferArray)); erts_atomic64_init_nob(&buffers->nonempty_slots, (erts_aint64_t)(Uint64)0); erts_atomic64_init_nob(&buffers->nonmsg_slots, (erts_aint64_t)(Uint64)0); - erts_atomic64_init_nob(&buffers->dirty_refc, (erts_aint64_t)(Uint64)1); + erts_refc_init(&buffers->dirty_refc, 1); buffers->nr_of_enqueues = 0; buffers->nr_of_rounds = 0; buffers->alive = 1; @@ -8500,7 +8500,7 @@ erts_proc_sig_queue_get_buffers(Process* p, int *need_unread) erts_thr_progress_unmanaged_continue(dhndl); return NULL; } - erts_atomic64_inc_mb(&buffers->dirty_refc); + erts_refc_inc(&buffers->dirty_refc, 2); erts_thr_progress_unmanaged_continue(dhndl); *need_unread = 1; return buffers; @@ -8513,12 +8513,13 @@ void erts_proc_sig_queue_unget_buffers(ErtsSignalInQueueBufferArray* buffers, return; } else { int i; - erts_aint64_t refc = erts_atomic64_dec_read_mb(&buffers->dirty_refc); - ASSERT(refc >= 0); + erts_aint_t refc = erts_refc_dectest(&buffers->dirty_refc, 0); if (refc != 0) { return; } + ASSERT(!buffers->alive); for (i = 0; i < ERTS_PROC_SIG_INQ_BUFFERED_NR_OF_BUFFERS; i++) { + ASSERT(!buffers->slots[i].b.alive); erts_mtx_destroy(&buffers->slots[i].b.lock); } erts_free(ERTS_ALC_T_SIGQ_BUFFERS, buffers); -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor