refactor(libkernel): shard SyncOnAddress waiters across hashed buckets #8323

Closed
Aryansh1520 wants to merge 1 commit from upstream-pr/8323 into main
Aryansh1520 commented 2026-10-20 10:05:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-20T10:05:29Z.


What

Shards the SyncOnAddress waiter queue across 64 buckets chosen by hashing the address. Each bucket has its own mutex and map, so waits and wakes on unrelated addresses no longer contend on one global lock. The change is the work of #2528 by @nahshongraham97, ported onto current main (the original commit no longer applies cleanly) and credited as co-author. #2528 stays open for its author.

Tested

Linux x86-64 (CachyOS, kernel 7.2.10): the focused guest_umtx_op test passes on the ported branch (ctest -R '^guest_umtx_op$'); tools/check_conventions.py --base origin/main passes. Not measured for speed: no performance claim is made here.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4934188089 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323). Originally posted by [Aryansh1520](https://github.com/Aryansh1520) on 2026-10-20T10:05:29Z. --- ### What Shards the `SyncOnAddress` waiter queue across 64 buckets chosen by hashing the address. Each bucket has its own mutex and map, so waits and wakes on unrelated addresses no longer contend on one global lock. The change is the work of #2528 by @nahshongraham97, ported onto current `main` (the original commit no longer applies cleanly) and credited as co-author. #2528 stays open for its author. ### Tested Linux x86-64 (CachyOS, kernel 7.2.10): the focused `guest_umtx_op` test passes on the ported branch (`ctest -R '^guest_umtx_op$'`); `tools/check_conventions.py --base origin/main` passes. Not measured for speed: no performance claim is made here. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-20 10:05:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T10:05:50Z.


This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288481756 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323#issuecomment-6288481756). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T10:05:50Z. --- <!-- pr-labels-perf --> This pull request is labeled `perf`, so it needs the summary line of a capture on `main` and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both `aps5-summary.jsonl` lines, attach the two traces and add the output of `tools/trace_digest.py`.
github-actions[bot] commented 2026-10-20 10:20:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T10:20:49Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 2528 core/libs/prx/libkernel/SyncOnAddress/src/SyncOnAddress.cpp
PR 8725 core/libs/prx/libkernel/SyncOnAddress/src/SyncOnAddress.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288730863 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323#issuecomment-6288730863). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T10:20:49Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 2528](https://www.github.com/boykopovar/AnyPS5/pull/2528) | `core/libs/prx/libkernel/SyncOnAddress/src/SyncOnAddress.cpp` | | [PR 8725](https://www.github.com/boykopovar/AnyPS5/pull/8725) | `core/libs/prx/libkernel/SyncOnAddress/src/SyncOnAddress.cpp` |
blawesom commented 2026-10-21 05:06:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-21T05:06:43Z.


Duplicate detection (support triage): this PR and #2528 ("perf(libkernel): shard SyncOnAddress waiters across hashed buckets", FitzVB, opened 2026-10-10) change the same file with byte-identical content hunks — the same 12 bucket/hash/shard additions to SyncOnAddress/src/SyncOnAddress.cpp, only hunk offsets differ because #2528 branched from an older main. Both are currently labeled needs rebase. Per the contributing rules, please coordinate with the author of #2528 on which one goes first and declare it with Depends on on the checklist line. Not flagging which should win — the earlier PR has the older base, this one is closer to current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308522006 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323#issuecomment-6308522006). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-21T05:06:43Z. --- Duplicate detection (support triage): this PR and #2528 ("perf(libkernel): shard SyncOnAddress waiters across hashed buckets", FitzVB, opened 2026-10-10) change the same file with byte-identical content hunks — the same 12 bucket/hash/shard additions to `SyncOnAddress/src/SyncOnAddress.cpp`, only hunk offsets differ because #2528 branched from an older main. Both are currently labeled `needs rebase`. Per the contributing rules, please coordinate with the author of #2528 on which one goes first and declare it with `Depends on` on the checklist line. Not flagging which should win — the earlier PR has the older base, this one is closer to current main.
Aryansh1520 commented 2026-10-21 08:22:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-21T08:22:59Z.


@oneandonlydean this PR and #2528 (FitzVB) carry the same SyncOnAddress sharding, which blawesom flagged on 2026-10-21. Where things stand:

  • #2528 is open and labelled needs rebase. Its last activity is your rebase request (2026-10-17) and blawesom's triage note. FitzVB has not replied on #2528, #8304 or this PR, so the order has not been agreed with them.
  • This PR is #2528's change ported onto current main, with nahshongraham97 credited as co-author, because the original commit no longer applies. The conflict came from #8304 landing on main and changing the same queue.
  • The rebased branch is ready locally: it passes ctest -R '^guest_umtx_op$' and check_conventions.py --base origin/main. It is not pushed yet, so this PR's head still shows the old conflicting commit until that push lands.
  • The checklist keeps Depends on: none, because neither PR needs the other to build. The overlap is a choice of which one lands, not a dependency.

Options for the order:

  1. Land this PR and close #2528 as superseded.
  2. Land #2528 first and rebase this PR on it.
  3. Keep both open until FitzVB replies.

Which do you want? I'll follow your call and update the checklist line to match.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311469730 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323#issuecomment-6311469730). Originally posted by [Aryansh1520](https://github.com/Aryansh1520) on 2026-10-21T08:22:59Z. --- @oneandonlydean this PR and #2528 (FitzVB) carry the same `SyncOnAddress` sharding, which blawesom flagged on 2026-10-21. Where things stand: - #2528 is open and labelled `needs rebase`. Its last activity is your rebase request (2026-10-17) and blawesom's triage note. FitzVB has not replied on #2528, #8304 or this PR, so the order has not been agreed with them. - This PR is #2528's change ported onto current `main`, with nahshongraham97 credited as co-author, because the original commit no longer applies. The conflict came from #8304 landing on `main` and changing the same queue. - The rebased branch is ready locally: it passes `ctest -R '^guest_umtx_op$'` and `check_conventions.py --base origin/main`. **It is not pushed yet**, so this PR's head still shows the old conflicting commit until that push lands. - The checklist keeps `Depends on: none`, because neither PR needs the other to build. The overlap is a choice of which one lands, not a dependency. Options for the order: 1. Land this PR and close #2528 as superseded. 2. Land #2528 first and rebase this PR on it. 3. Keep both open until FitzVB replies. Which do you want? I'll follow your call and update the checklist line to match.
oneandonlydean commented 2026-10-21 08:26:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T08:26:41Z.


Thanks for this. #2528 makes the same change (sharding SyncOnAddress waiters across hashed buckets) and is already in review, so we'll carry it there. Closing this one as a duplicate.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311534180 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323#issuecomment-6311534180). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T08:26:41Z. --- Thanks for this. #2528 makes the same change (sharding SyncOnAddress waiters across hashed buckets) and is already in review, so we'll carry it there. Closing this one as a duplicate.
oneandonlydean commented 2026-10-21 08:52:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T08:52:29Z.


@Aryansh1520 thanks for laying this out, and for crediting the original author. Your port onto current main is still useful: #2528 needs exactly that rebase, so if you'd like, post the rebased commit (or a link to your branch) on #2528 and we can use it there, with your co-author line kept.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311996573 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323#issuecomment-6311996573). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T08:52:29Z. --- @Aryansh1520 thanks for laying this out, and for crediting the original author. Your port onto current `main` is still useful: #2528 needs exactly that rebase, so if you'd like, post the rebased commit (or a link to your branch) on #2528 and we can use it there, with your co-author line kept.
Aryansh1520 commented 2026-10-21 09:16:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-21T09:16:33Z.


@oneandonlydean posted the rebased commit on #2528 with the link and your co-author line kept. Thanks.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6312438614 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8323#issuecomment-6312438614). Originally posted by [Aryansh1520](https://github.com/Aryansh1520) on 2026-10-21T09:16:33Z. --- @oneandonlydean posted the rebased commit on #2528 with the link and your co-author line kept. Thanks.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8323
No description provided.