Skip to content
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

Save thread context before yielding for GC #78

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

qinsoon
Copy link
Member

@qinsoon qinsoon commented Dec 5, 2024

This PR ports mmtk/mmtk-julia#159 to dev. The difference is that this PR adds a general call to the GC interface jl_gc_notify_thread_yield. In this case, each GC will do what they need in the call, and the context is saved in the GC specific TLS.

@qinsoon qinsoon requested a review from udesou December 5, 2024 03:40
src/gc-stock.c Outdated
@@ -2930,6 +2930,7 @@ size_t jl_maxrss(void);
// Only one thread should be running in this function
static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection)
{
jl_gc_notify_thread_yield(ptls, NULL);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this call here, if the function is empty for Stock?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It is empty. I just added this for clarification, as this is a place where a thread may yield. If the function impl is somehow not empty for stock in the future, this call will be useful. If you require this to be removed, or this is required to be removed when we upstream this, it can be removed.

I can put the above into a comment if you think that would be helpful.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment might be useful indeed. Another question is, should we have that call in here instead for consistency? Or we would need to notify it twice for both times they call _jl_gc_collect (including that recollect phase)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I made the change.

Copy link

@udesou udesou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@qinsoon qinsoon merged commit 8dc5535 into mmtk:dev Dec 6, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants