Skip to content

Commit

Permalink
add a test for page utilization metric (JuliaLang#52411)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-netto committed Dec 6, 2023
1 parent 627210d commit e2af398
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2969,7 +2969,7 @@ size_t gc_count_work_in_queue(jl_ptls_t ptls) JL_NOTSAFEPOINT
* have tried to steal from the queue which still has a work item left, but failed to do so,
* which violates the semantics of Chase-Lev's work-stealing queue.
*
* - Let E1 be the event "master thread writes -1 to gc_master_tid" and E2 be the even
* - Let E1 be the event "master thread writes -1 to gc_master_tid" and E2 be the event
* "master thread observes that `gc_n_threads_marking` is zero". Since we're using
* sequentially consistent atomics, E1 => E2. Now suppose one thread which is spinning in
* `gc_should_mark` tries to enter the mark-loop after E2. In order to do so, it must
Expand Down
8 changes: 8 additions & 0 deletions test/gc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function run_gctest(file)
end
end

function run_nonzero_page_utilization_test()
GC.gc()
page_utilization = Base.gc_page_utilization_data()
# at least one of the pools should have nonzero page_utilization
@test any(page_utilization .> 0)
end

# !!! note:
# Since we run our tests on 32bit OS as well we confine ourselves
# to parameters that allocate about 512MB of objects. Max RSS is lower
Expand All @@ -24,4 +31,5 @@ end
run_gctest("gc/linkedlist.jl")
run_gctest("gc/objarray.jl")
run_gctest("gc/chunks.jl")
run_nonzero_page_utilization_test()
end

0 comments on commit e2af398

Please sign in to comment.