Skip to content

dd: stop the copy-buffer RSS check from racing other tests - #14804

Merged
sylvestre merged 2 commits into
uutils:mainfrom
abendrothj:fix/dd-copy-buffer-rss-test
Sep 25, 2026
Merged

sylvestre merged 2 commits into
uutils:mainfrom
abendrothj:fix/dd-copy-buffer-rss-test

Conversation

@abendrothj

@abendrothj abendrothj commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

copy_buffer_does_not_touch_its_pages failed intermittently in CI with attempt to subtract with overflow (seen on x86_64-unknown-linux-musl). It read VmHWM from /proc/self/status, which is shared with every other test in the binary — the kernel reports VmHWM as the maximum of the stored watermark and the current RSS, so a reading taken while another test thread held pages could come out higher than the later one.

The check now lives in tests/by-util/test_dd.rs, runs the real dd with bs=4G, and reads that child process's own peak RSS from wait4, so nothing running in parallel can affect it. On Linux the growth over a bs=4K baseline stays within ~150 KiB across runs against a 64 MiB bound, and goes to ~4 GiB if the buffer's pages are touched.

VmHWM is reported as the maximum of the stored watermark and the current
RSS, so a reading taken while another test thread holds pages can come
out higher than a later one, and after - before underflowed. Take the
measurement in a child process running this test alone, and compute the
growth with a saturating subtraction.
Copilot AI lite review requested due to automatic review settings September 22, 2026 02:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread src/uu/dd/src/dd.rs Resolved
Comment thread src/uu/dd/src/dd.rs Resolved
Comment thread src/uu/dd/src/dd.rs Resolved
Copilot AI review requested due to automatic review settings September 25, 2026 02:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The unit test read /proc/self/status, which is shared with every other
test in the binary, so it had to re-exec itself to get a quiet process.
Running the real dd instead and reading the child's own peak RSS through
wait4 drops that machinery and removes the race.
@abendrothj
abendrothj force-pushed the fix/dd-copy-buffer-rss-test branch from 05f056c to a4904b4 Compare September 25, 2026 02:55
@codspeed

codspeed Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 18 untouched benchmarks
⏩ 426 skipped benchmarks1


Comparing abendrothj:fix/dd-copy-buffer-rss-test (a4904b4) with main (d726692)

Open in CodSpeed

Footnotes

  1. 426 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. ↩

@sylvestre
sylvestre merged commit 3242ee4 into uutils:main Sep 25, 2026
98 checks passed
@abendrothj
abendrothj deleted the fix/dd-copy-buffer-rss-test branch September 25, 2026 14:41
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.

3 participants