Skip to content

Commit

Permalink
Fix race between verify_pool and the marking phase
Browse files Browse the repository at this point in the history
`verify_pool` is a function used to check the invariant that a major
pool should contain no garbage after sweeping. It is obviously allowed
to race with marking (which can only turn UNMARKED objects into MARKED
or NOT_MARKABLE, but not into GARBAGE), we only need to mark the read as
a relaxed atomic read.
  • Loading branch information
OlivierNicole committed Jan 24, 2024
1 parent a682d51 commit 6169c18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ jobs:
- id: normal
name: normal
dependencies: libunwind-dev
# Running with the debug runtime is disabled until the data races in
# it are fixed (see #12902).
#- id: debug
# name: debug runtime
# dependencies: libunwind-dev
- id: debug
name: debug runtime
dependencies: libunwind-dev
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion runtime/shared_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ static void verify_pool(pool* a, sizeclass sz, struct mem_stats* s) {
s->overhead += POOL_SLAB_WOFFSET(sz);

while (p + wh <= end) {
header_t hd = (header_t)*p;
header_t hd = atomic_load_relaxed(p);
CAMLassert(hd == 0 || !Has_status_hd(hd, caml_global_heap_state.GARBAGE));
if (hd) {
s->live += Whsize_hd(hd);
Expand Down

0 comments on commit 6169c18

Please sign in to comment.