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

Fix performance regression caused by a bug fix #8751

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

bjorng
Copy link
Contributor

@bjorng bjorng commented Aug 27, 2024

a180597 in #8539, a correction for an unsafe in-place update of a record, had the side effect of causing a major (fullsweep) garbage collection when GC has been temporarily disabled and then again enabled. Since many BIFs, such as term_to_binary/1 and iolist_to_binary/1, may temporarily disable GC, this could lead to noticeable performance regressions.

This pull request ensures that it is again possible to do a minor collection when GC is being enabled.

@bjorng bjorng added team:VM Assigned to OTP team VM fix testing currently being tested, tag is used by OTP internal CI labels Aug 27, 2024
@bjorng bjorng requested a review from sverker August 27, 2024 08:38
@bjorng bjorng self-assigned this Aug 27, 2024
Copy link
Contributor

github-actions bot commented Aug 27, 2024

CT Test Results

    3 files    143 suites   49m 25s ⏱️
1 591 tests 1 541 ✅ 49 💤 1 ❌
2 330 runs  2 255 ✅ 74 💤 1 ❌

For more details on these failures, see this check.

Results for commit 9712516.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@bjorng bjorng force-pushed the bjorn/erts/fix-delay-gc/OTP-12909 branch 2 times, most recently from e7e458a to 13df903 Compare August 27, 2024 12:02
Copy link
Contributor

@sverker sverker left a comment

Choose a reason for hiding this comment

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

I don't like the high_water = -1 hack.
I don't like different semantics for high_water on jit vs emu.

What about letting delay_garbage_collection() always set high_water correctly for the active heap (p->high_water = p->heap I suppose).
To save space you could save abandoned_high_water at the end of the heap fragment for the new active heap for example.

@bjorng
Copy link
Contributor Author

bjorng commented Aug 28, 2024

@sverker I've rewritten the PR as you suggested.

Copy link
Contributor

@sverker sverker left a comment

Choose a reason for hiding this comment

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

I did git grep -iw high_water in erts/emulator and found some places that need tweaks:

beam_bp.c:
get_allocated_words() can be simplified to ignore abandoned_heap.

erl_bif_trace.c:
new_seq_trace_token() must be fixed

erl_gc.c:
ErtsGcQuickSanityCheck() can always assert high_water between heap and hend.
erts_process_gc_info() must be fixed.

erts/emulator/beam/erl_gc.c Outdated Show resolved Hide resolved
@bjorng bjorng force-pushed the bjorn/erts/fix-delay-gc/OTP-12909 branch 2 times, most recently from c5d85e0 to 9712516 Compare August 30, 2024 05:14
a180597 in erlang#8539, a correction for an unsafe in-place update
of a record, had the side effect of causing a major (fullsweep)
garbage collection when GC has been temporarily disabled and then
again enabled. Since many BIFs, such as `term_to_binary/1` and
`iolist_to_binary/1`, may temporarily disable GC, this could lead to
noticeable performance regressions.

This commit ensures that it is again possible to do a minor collection
when GC is being enabled.
@bjorng bjorng force-pushed the bjorn/erts/fix-delay-gc/OTP-12909 branch from 9712516 to 8f811c9 Compare September 2, 2024 11:40
@bjorng bjorng merged commit ebdea3e into erlang:maint Sep 2, 2024
3 checks passed
@bjorng bjorng deleted the bjorn/erts/fix-delay-gc/OTP-12909 branch September 2, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants