-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove a bunch of 'skip GC threads' checks since they now have tasks #55160
Conversation
8babca2
to
758b3ad
Compare
758b3ad
to
57e33d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think CI tests either of these so we need to manually check. I suggest running one of the multithreaded GC benchmarks with the concurrent sweep thread enabled, and insert ccall
s to jl_live_tasks()
and jl_print_task_backtraces(1)
somewhere in the middle.
TestFrom GCBenchmarks: include(joinpath("..", "..", "..", "util", "utils.jl"))
module BinaryTreeImmutable
# Adopted from
# https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/binarytrees.html#binarytrees
using Base.Threads
using Printf
struct Node
l::Union{Nothing, Node}
r::Union{Nothing, Node}
end
function make(n::Int)
return n === 0 ? Node(nothing, nothing) : Node(make(n-1), make(n-1))
end
function check(node::Node)
return 1 + (node.l === nothing ? 0 : check(node.l) + check(node.r))
end
function dummy_task()
while true
tasks = @ccall jl_live_tasks()::Any
@show tasks
@ccall jl_print_task_backtraces(1::Cint)::Cvoid
sleep(100)
end
end
function binary_trees(io, n::Int)
@printf io "stretch tree of depth %jd\t check: %jd\n" n+1 check(make(n+1))
Threads.@spawn dummy_task()
long_tree = make(n)
minDepth = 4
resultSize = div((n - minDepth), 2) + 1
results = Vector{String}(undef, resultSize)
Threads.@threads for depth in minDepth:2:n
c = 0
niter = 1 << (n - depth + minDepth)
for _ in 1:niter
c += check(make(depth))
end
index = div((depth - minDepth),2) + 1
results[index] = @sprintf "%jd\t trees of depth %jd\t check: %jd\n" niter depth c
end
for i in results
write(io, i)
end
@printf io "long lived tree of depth %jd\t check: %jd\n" n check(long_tree)
end
end #module
using .BinaryTreeImmutable
@gctime BinaryTreeImmutable.binary_trees(devnull, 21) Command
Output
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
GC threads now have tasks (since #53815).