feat(scheduler-sim-live-allocation): make capacity checks core-safe (task 1.3)

Re-types sched_meet_host_selection(), sched_check_shared_satisfy()
(+its _ helper), sched_check_host_satisfy() (+its _ helper), and the
private unsatisfy_() helper they share, from xce_scheduler_t* to
xce_sched_core_t*, in resource.c.

Fixes every call site this forces (a C signature migration cannot
keep the build green otherwise): sched_try_alloc_on_host_() (2 sites,
already partially touched by task 1.2), host_iter.c's
sched_host_iter_next() (2 sites), and parjob_allocator.c/
seqjob_allocator.c's my_alloc() (1 site each) -- each fix is a minimal
&(sched->core) argument wrap, no algorithm change, preserving
host_iter/parjob/seqjob's own allocation algorithm exactly as-is.

Adds test_core_safe_allocation_chain_driver_parity, proving all three
functions produce identical grant/deny results whether given
normal-mode-shaped or simulation-mode-shaped core state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
Rongsong Shen 2026-09-18 12:42:11 +00:00
parent e8866641a6
commit 55173fca27
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
13 changed files with 345 additions and 53 deletions

View file

@ -136,19 +136,22 @@ int __wrap_xcecli_join(xcecli_ctx_t c, int role, hostattrs_t* attrs)
* the decisive "did the real allocator run" signal.
* ════════════════════════════════════════════════════════════════════════ */
extern int __real_sched_meet_host_selection(xce_scheduler_t*,
/* scheduler-sim-live-allocation task 1.3: sched_meet_host_selection() is
* now core-typed (xce_sched_core_t*, not xce_scheduler_t*) -- the linker
* --wrap= interposition must match the real symbol's current signature. */
extern int __real_sched_meet_host_selection(xce_sched_core_t*,
xce_sched_worker_t*,
xce_select_t*);
static int g_select_calls = 0;
int __wrap_sched_meet_host_selection(xce_scheduler_t* sched,
int __wrap_sched_meet_host_selection(xce_sched_core_t* core,
xce_sched_worker_t* w,
xce_select_t* select)
{
g_select_calls++;
return __real_sched_meet_host_selection(sched, w, select);
return __real_sched_meet_host_selection(core, w, select);
}
void setUp(void) { return; }