Skip to content

feat: logger: decrease binary size#5849

Merged
ShadowCurse merged 1 commit into
firecracker-microvm:mainfrom
ShadowCurse:logger_memory_save
Apr 21, 2026
Merged

feat: logger: decrease binary size#5849
ShadowCurse merged 1 commit into
firecracker-microvm:mainfrom
ShadowCurse:logger_memory_save

Conversation

@ShadowCurse
Copy link
Copy Markdown
Contributor

Changes

When new rate-limiter log macros were added, the binary size increased by ~150KiB. (mainly the .text section got bigger by ~105KiB)

In order to partially mitigate this move duplicated checking logic into a LogRateLimiter type and mark that function with inline(never)

This saves ~70KiB of .text section space.

Reason

Smaller binary

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

@ShadowCurse ShadowCurse self-assigned this Apr 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 8.33333% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.04%. Comparing base (53b382a) to head (63d322d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/vmm/src/logger/rate_limited.rs 8.33% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5849      +/-   ##
==========================================
- Coverage   83.07%   83.04%   -0.04%     
==========================================
  Files         276      276              
  Lines       29546    29558      +12     
==========================================
+ Hits        24546    24547       +1     
- Misses       5000     5011      +11     
Flag Coverage Δ
5.10-m5n.metal 83.37% <8.33%> (-0.04%) ⬇️
5.10-m6a.metal 82.70% <8.33%> (-0.04%) ⬇️
5.10-m6g.metal 79.96% <8.33%> (-0.04%) ⬇️
5.10-m6i.metal 83.37% <8.33%> (-0.04%) ⬇️
5.10-m7a.metal-48xl 82.69% <8.33%> (-0.04%) ⬇️
5.10-m7g.metal 79.96% <8.33%> (-0.04%) ⬇️
5.10-m7i.metal-24xl 83.34% <8.33%> (-0.04%) ⬇️
5.10-m7i.metal-48xl 83.34% <8.33%> (-0.04%) ⬇️
5.10-m8g.metal-24xl 79.95% <8.33%> (-0.05%) ⬇️
5.10-m8g.metal-48xl 79.96% <8.33%> (-0.04%) ⬇️
5.10-m8i.metal-48xl 83.34% <8.33%> (-0.04%) ⬇️
5.10-m8i.metal-96xl 83.34% <8.33%> (-0.04%) ⬇️
6.1-m5n.metal 83.40% <8.33%> (-0.04%) ⬇️
6.1-m6a.metal 82.73% <8.33%> (-0.04%) ⬇️
6.1-m6g.metal 79.96% <8.33%> (-0.04%) ⬇️
6.1-m6i.metal 83.39% <8.33%> (-0.04%) ⬇️
6.1-m7a.metal-48xl 82.71% <8.33%> (-0.04%) ⬇️
6.1-m7g.metal 79.95% <8.33%> (-0.05%) ⬇️
6.1-m7i.metal-24xl 83.40% <8.33%> (-0.05%) ⬇️
6.1-m7i.metal-48xl 83.41% <8.33%> (-0.04%) ⬇️
6.1-m8g.metal-24xl 79.95% <8.33%> (-0.04%) ⬇️
6.1-m8g.metal-48xl 79.96% <8.33%> (-0.04%) ⬇️
6.1-m8i.metal-48xl 83.41% <8.33%> (-0.04%) ⬇️
6.1-m8i.metal-96xl 83.41% <8.33%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

JamesC1305
JamesC1305 previously approved these changes Apr 21, 2026
@ShadowCurse ShadowCurse added Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests labels Apr 21, 2026
Comment thread src/vmm/src/logger/mod.rs Outdated
JackThomson2
JackThomson2 previously approved these changes Apr 21, 2026
@ShadowCurse ShadowCurse dismissed stale reviews from JackThomson2 and JamesC1305 via b78bdad April 21, 2026 14:15
@ShadowCurse ShadowCurse force-pushed the logger_memory_save branch 2 times, most recently from b78bdad to 93cd705 Compare April 21, 2026 14:16
JackThomson2
JackThomson2 previously approved these changes Apr 21, 2026
JamesC1305
JamesC1305 previously approved these changes Apr 21, 2026
Comment thread src/vmm/src/logger/rate_limited.rs Outdated
zulinx86
zulinx86 previously approved these changes Apr 21, 2026
zulinx86
zulinx86 previously approved these changes Apr 21, 2026
When new rate-limiter log macros were added, the binary size increased
by ~150KiB. (mainly the .text section got bigger by ~105KiB)

In order to partially mitigate this move duplicated checking logic into
a `LogRateLimiter` type and mark that function with `inline(never)`

This saves ~70KiB of .text section space.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
@ShadowCurse ShadowCurse enabled auto-merge (rebase) April 21, 2026 16:31
@ShadowCurse ShadowCurse requested a review from zulinx86 April 21, 2026 16:32
@ShadowCurse ShadowCurse merged commit d9c543d into firecracker-microvm:main Apr 21, 2026
6 of 7 checks passed
@ShadowCurse ShadowCurse deleted the logger_memory_save branch April 21, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants