Skip to content

feat: improve segment check logic#10

Merged
not-matthias merged 3 commits into
masterfrom
cod-2661-improve-segment-check-logic-in-valgrind
May 20, 2026
Merged

feat: improve segment check logic#10
not-matthias merged 3 commits into
masterfrom
cod-2661-improve-segment-check-logic-in-valgrind

Conversation

@not-matthias
Copy link
Copy Markdown
Member

  • refactor(debuginfo): use find_rx_mapping for fallback DI lookup
  • test(callgrind): smoke-test VG_(find_DebugInfo) attribution

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 20, 2026

Merging this PR will degrade performance by 12.3%

❌ 2 regressed benchmarks
✅ 54 untouched benchmarks
⏩ 4 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
test_valgrind[valgrind.codspeed, stress-ng --cpu 1 --cpu-ops 10, full-with-inline] 8 s 8.9 s -10.54%
test_valgrind[valgrind-3.25.1, python3 testdata/test.py, full-no-inline] 5.3 s 6.1 s -14.02%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing cod-2661-improve-segment-check-logic-in-valgrind (465be51) with master (6349ba8)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@not-matthias not-matthias marked this pull request as ready for review May 20, 2026 10:54
@not-matthias
Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown

@GuillaumeLagrange GuillaumeLagrange left a comment

Choose a reason for hiding this comment

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

lgtm, we'll be able to release this soon IMO

Comment thread .github/workflows/codspeed.yml
The fallback added in 938e424 used VG_(am_find_nsegment) +
VG_(am_get_filename) + strcmp against each DI's fsm.filename. Replace
it with ML_(find_rx_mapping)(di, a, a), which walks the same set of
rx mappings already recorded for each DebugInfo and keeps a per-DI
single-entry cache (last_rx_map), so the hot path is O(1).

No coverage change for BOLT-style binaries: both R-E PT_LOADs are
recorded as rx DebugInfoMappings during ELF acceptance, so the loop
finds them just as well as the filename match did.

Also emit a Vg_DebugMsg trace when the fallback fires (only with -v -v).
Add a tiny C program with hot_fn in .text plus warm_fn/cold_fn in
orphan executable sections (warm_code/cold_code) that sit in the
same R-E LOAD but outside text_avma..text_avma+text_size. The
.vgtest compares the resolved ob= basenames against an expected
list, verifying callgrind attributes events to the test binary
even when execution leaves .text.
Drop the explicit CODSPEED_PERF_ENABLED=false override so the CodSpeed
action runs with its default perf integration.
@not-matthias not-matthias force-pushed the cod-2661-improve-segment-check-logic-in-valgrind branch from 48f7a21 to 465be51 Compare May 20, 2026 14:51
@not-matthias not-matthias merged commit 465be51 into master May 20, 2026
5 of 35 checks passed
@not-matthias not-matthias deleted the cod-2661-improve-segment-check-logic-in-valgrind branch May 20, 2026 15:42
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