feat(scheduler-sim-decision-parity): relocate resource accounting to core-level (task 1.1)

Relocates sched_account_jobs()/sched_charge_account()/sched_uncharge_account()/
sched_update_account()/sched_update_res_accounts()/sched_commit_job_alloc()
from xce_scheduler_t* to xce_sched_core_t*, mirroring the sched_resolve_job_picker()
precedent, so the simulation driver can call the same accounting service the
normal-mode driver already uses. Pure signature relocation -- every body
reference was already sched->core.*, no logic change. Updates the 3 real call
sites (driver.c's normal-mode round, scheduler.c's sched_begin_session and
sched_commit_decision) and 7 existing tests' link-satisfying stub signatures.

Adds test_resource_accounting.c proving Requirement 1.4: the relocated
accounting produces identical resInUse/sharedInUse output whether called
against a core embedded in xce_scheduler_t or xce_sched_sim_driver_t.

43/44 scheduler tests pass; the 1 failure is pre-existing bug-1560
(unrelated recording.c sandbox-permission ordering issue).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-22 06:04:03 +00:00
parent 0b2c856d8b
commit 3106c82ed0
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
15 changed files with 498 additions and 75 deletions

View file

@ -1,7 +1,7 @@
# Implementation Plan
- [ ] 1. Foundation: shared accounting surface and contention test data
- [ ] 1.1 Make resource-in-use accounting callable from either driver
- [x] 1.1 Make resource-in-use accounting callable from either driver
- Relocate the resource re-accounting service (currently tied to the normal-mode-only driver struct) so it operates on the mode-agnostic core state shared by both drivers, mirroring the same relocation already done for the job-picker resolution service
- Update all three existing call sites to the new signature: the normal-mode round handler's accounting call, the scheduler's own session-begin path's accounting call, and the scheduler's decision-commit path's call into the job-allocation-commit function that is part of this same relocated group
- Body of the accounting logic itself is unchanged — this is a pure capability-relocation step, not new behavior