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:
parent
0b2c856d8b
commit
3106c82ed0
15 changed files with 498 additions and 75 deletions
|
|
@ -246,6 +246,47 @@ extern int sched_queue_is_ready(xce_sched_queue_t*);
|
|||
*/
|
||||
extern int sched_resolve_job_picker(xce_sched_core_t*, xce_sched_plugin_t**);
|
||||
|
||||
/*
|
||||
* sched_account_jobs/sched_charge_account/sched_uncharge_account/
|
||||
* sched_commit_job_alloc - resource-in-use accounting (scheduler-sim-
|
||||
* decision-parity spec, task 1.1). Relocated from scheduler.c/resource.c's
|
||||
* xce_scheduler_t* signature to this xce_sched_core_t* signature, following
|
||||
* the exact same precedent sched_resolve_job_picker established above (task
|
||||
* 4.3): pure signature relocation, body unchanged -- every reference in
|
||||
* these functions' bodies already only touched sched->core.* before this
|
||||
* move. Moved so the simulation driver (which has no xce_scheduler_t* of
|
||||
* its own, only xce_sched_core_t) can call the same accounting service the
|
||||
* normal-mode driver already uses, restoring the resource-in-use accounting
|
||||
* parity `.kiro/steering/scheduler-driver-equivalence.md` documents.
|
||||
*
|
||||
* sched_account_jobs() - re-derives resInUse/sharedInUse from every
|
||||
* currently-running job's known resource allocation (job->accounts != NULL)
|
||||
* by re-charging each one via sched_charge_account(). Skips a RUN-state job
|
||||
* whose allocation is not yet known -- not an error; see
|
||||
* scheduler-sim-decision-parity design.md's Recorded-Decision Reconciliation
|
||||
* component for why that is the expected state before this call runs.
|
||||
* Callers (both drivers) must call this strictly after the session's resval
|
||||
* reset and strictly before the picker/allocator are unblocked -- see
|
||||
* xce_core_begin_session()/xce_core_signal_go()'s own doc comment below for
|
||||
* the full ordering contract this depends on. Was exported (no longer
|
||||
* `static`) as of scheduler-core spec task 5.2 for the identical reason;
|
||||
* still defined in scheduler.c, only its declaration/signature move here.
|
||||
*
|
||||
* sched_charge_account()/sched_uncharge_account() - add/remove one job's
|
||||
* xce_job_account_t (shared + per-host resource usage) to/from
|
||||
* core->sharedInUse and each worker's resInUse.
|
||||
*
|
||||
* sched_commit_job_alloc() - charges a job's already-resolved allocation
|
||||
* (job->accounts) via sched_charge_account(); a no-op (returns 0) if the
|
||||
* job's allocation is not yet known. Called by sched_commit_decision()
|
||||
* (scheduler.c) immediately after a fresh DISPATCH decision populates
|
||||
* job->allocs/job->accounts.
|
||||
*/
|
||||
extern int sched_account_jobs(xce_sched_core_t*);
|
||||
extern int sched_charge_account(xce_sched_core_t*, xce_job_account_t*);
|
||||
extern int sched_uncharge_account(xce_sched_core_t*, xce_job_account_t*);
|
||||
extern int sched_commit_job_alloc(xce_sched_core_t*, xce_sched_job_t*);
|
||||
|
||||
/*
|
||||
* xce_core_event_type_t / xce_core_event_t - the core's typed input-event
|
||||
* representation (scheduler-core spec, task 4.3, Req 5 AC 4). Exactly the 9
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue