Skip to content

perf: avoid charging mmap aliases twice - #948

Merged
RyanTheTide merged 2 commits into
integration/aurorafrom
perf/mmap-alias-accounting-squash
Nov 9, 2026
Merged

RyanTheTide merged 2 commits into
integration/aurorafrom
perf/mmap-alias-accounting-squash

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Replacement for #947, retained as the review thread. The first unsigned squash commit 85b4a97 has tree 375a6a354713d4fb957965e797e986365b888b4b, identical to reviewed #947 head e2bf3e2. Follow-up commit 5355437 registers its host test; current head tree 3065bc736d68e1e92a0dc644304a03912ff7f322 is therefore not identical to #947. Both commits are unsigned; Joshua must personally review and add DCO sign-off.

The actual host runner rejected the missing registration before the fix and ran the selected harness after it: 1/1 passed, with 26/26 lifecycle cases. The harness stubs kernel plumbing and is single-user, single-mm, single-threaded; this is not runtime or hardware validation. Existing cross-user AUX and cross-mm ownership issues are separate.

Draft pending review of the new head, Joshua's sign-off, and normal maintainer process.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Added 5355437 to register perf-mmap-alias-lifecycle-tests.py in tools/asahi/run-host-tests.py: the runner rejected the unregistered file (exit 2 before), then ran it successfully (1/1 PASS after). Kernel hunks are unchanged, so Chris can re-check just this commit.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Update on this PR (for the reviewer).

What changed since #947 (head e2bf3e2):

Status: still a draft. The host-tests run has not started on the new head yet; I will update this thread when it does. #961 is stacked on this PR; its head is 77d5714.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Host tests were run locally on head 02152b1 (GitHub Actions is currently disabled for this repository, so the hosted workflow did not run).

Command (the CI workflow's test step, in a worktree at 02152b1):
python3 -I tools/asahi/run-host-tests.py --jobs 16 --work <dir>

Full-suite numbers, run in the same session under the same environment:

  • 02152b1 (this PR): 196 runs, 153 ok, 43 FAIL.
  • Parent 1d76233 (control): 196 runs, 153 ok, 40 FAIL.

Environment caveat: the local host is not the CI image. Deviations from .github/workflows/host-tests.yml: clang 14 vs pinned 18, gcc 12 vs 13, rustc 1.98 vs 1.96.0, Python 3.11 vs 3.14, glibc 2.36 vs Ubuntu 24.04's 2.39. Two consequence classes: brcmf control builds fail to compile (strlcat needs glibc 2.38+), and several runs die with AddressSanitizer DEADLYSIGNAL.

Triage: every test whose result differed between the two trees was rerun three times per tree. No failure is attributable to this PR:

  • No differing test failed deterministically on this PR. Every label that ever failed only here did so 1-2 of 3 iterations and passed the rest on the same tree (examples: apple-pwm-pm-tests 1/3, ave-probe-pm-tests 1/3, mt7932-owe-retry-tests 2/3, plus tb-dp/tiled-split mutants and brcmf/rtkit mutations).
  • Each such instance was environmental: an ASan DEADLYSIGNAL crash, or a mutation crashing with SIGSEGV instead of the clean assertion the CI toolchain produces (exit -11/245 "without a control failure"), or a negative control whose old-code compile behaves differently under clang 14. The same labels fail on the parent tree in other runs; only the distribution differs.
  • This PR's own registered test, perf-mmap-alias-lifecycle-tests, passed in every run on both trees.
  • The failures common to both trees (apple-dcp, asahi-m4, apple-afkv2, tb-dp-repair-tests, tiled-split-tests and the brcmf/strlcat builds) are the environment issues above and are identical on the parent commit.

Logs retained locally with per-run output for every rerun iteration.

@joshuaswarren
joshuaswarren marked this pull request as ready for review November 6, 2026 14:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T15:52:59.172947Z 02152b1 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-06T15:54:25.656840Z 02152b1 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@joshuaswarren
joshuaswarren marked this pull request as draft November 6, 2026 14:49
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

A/B verdict table (follow-up to the earlier host-tests comment).

Method: the 13 tests whose results ever differed between the parent tree and this PR's head were each run 10 more times per tree on one host, interleaved (parent first, then the PR, alternating, 10 rounds). No other variable changed between the paired runs. The four tb-dp/tiled-split mutant names are sub-verdicts of their parent --mutations run (they are not individually invocable) and counted as failed only when the parent named them in a FAIL line. All 180 invocations produced verdicts.

test parent fails/10 PR fails/10 Fisher p (two-sided)
apple-pwm-pm-tests 4 1 0.303
ave-probe-pm-tests 3 1 0.582
ave-probe-pm-tests --negative-control 2 2 1.000
apple-m4-pmu-tests 0 2 0.474
apple-m4-pmu-tests --mutation flags-in-event 2 4 0.628
brcmf-suspend-tests --mutation queue-reasons 2 2 1.000
brcmf-suspend-tests --mutation resume-order 1 5 0.141
mt7932-owe-retry-tests 2 2 1.000
rtkit-oslog-tests --mutate buffer 3 2 1.000
tiled-split-tests: split-existing-active 2 3 1.000
tb-dp-repair-tests: t6030-dpin1-alone 0 0 1.000
tb-dp-repair-tests: t6030-dpin1-alone-before-services 1 0 1.000
tb-dp-repair-tests: t6030-split-off 1 1 1.000

Verdict: no test fails more on the PR at p < 0.05. The largest skew toward the PR (resume-order, 5 vs 1) has p = 0.141 two-sided (0.070 one-sided). Every differing test fails on both trees at similar rates; the causes are host-environment (see the companion issue), not this PR. This PR's own test, perf-mmap-alias-lifecycle-tests, passed in every run on both trees.

@joshuaswarren
joshuaswarren marked this pull request as ready for review November 6, 2026 15:44
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Flaky-host-tests report (the environment causes behind the flaky rows in the table above), filed as a discussion since this repo has issues disabled: #1044

Charge normal-ring and AUX pages only on first allocation. Repeated
aliases share the existing charge; the final close releases it once. A
failed alias mapping previously left an extra per-user charge.

Add a source-level host regression for duplicate and failed aliases,
metadata-only rings, limit splitting and alternate close orders. Against
the exact base the harness reports 16 failing alias cases; on this tree
it passes 26/26. A focused x86-64 core.o build passed. This is single-
user, single-mm, single-threaded host testing with stubbed kernel
plumbing; it is not runtime or hardware validation.

Fixes: 0c8a4e4 ("perf/core: Further simplify perf_mmap()")
Assisted-by: LLM
Signed-off-by: Joshua Warren <[email protected]>
Register the alias lifecycle harness so the host-test runner executes it instead of rejecting the unregistered file. Verified with the runner before and after registration.

Assisted-by: LLM
Signed-off-by: Joshua Warren <[email protected]>
@joshuaswarren
joshuaswarren force-pushed the perf/mmap-alias-accounting-squash branch from 02152b1 to 37c5cb7 Compare November 8, 2026 16:39
@joshuaswarren

joshuaswarren commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] The base moved, so this branch had conflicts. I rebased onto integration/aurora 9c607045.

  • perf: avoid charging mmap aliases twice is unchanged. The patch matches exactly.
  • test: register perf mmap accounting host check hit one conflict in tools/asahi/run-host-tests.py. The base added new test entries. I kept the base registry and re-added only our line.
  • New head: 37c5cb7deebf.
  • I re-ran the perf check at the new head with --only perf-mmap-alias. It passed: ok perf-mmap-alias-lifecycle-tests (0.2s), 1/1 passed.

RyanTheTide added a commit that referenced this pull request Nov 9, 2026
@RyanTheTide
RyanTheTide merged commit 8176567 into integration/aurora Nov 9, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the perf/mmap-alias-accounting-squash branch November 16, 2026 05:11
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