feat(scheduler-allocation): clear unsatisfiable-resreq cache per session
Clear the cache inside core_begin_session_internal() so a job cached as unsatisfiable in one session is re-evaluated fresh in the next (Req 7.2). An initial weak-symbol cast-based approach was rejected: it corrupted xce_sched_sim_driver_t.alt_events_file, since core_begin_session_internal() is shared between driver.c (real xce_scheduler_t) and sim_loop.c (a structurally different, deliberately isolated sim driver struct with no cache field at the same byte offset) -- the strong cache_clear() symbol won unconditionally for both, invisible to ASAN and untested by any test_sim_*.c file. Fixed via a driver-registered callback: xce_sched_core_t gains a cache_clear_cb hook (NULL by default, per xce_sched_core_init()'s full-struct memset), set only in main.c's driver-mode branch -- mirroring the existing on_decision/xce_core_set_decision_cb() pattern. --sim mode returns before that registration is ever reached, so its hook stays NULL and core_begin_session_internal()'s guarded call is a no-op. The real xce_scheduler_t-casting adapter lives in alloc_cache.c rather than driver.c, since ~11 tests white-box-include driver.c without linking alloc_cache.c. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYdtrEWWZfKRRGED7raEYg
This commit is contained in:
parent
5c022d0b4f
commit
e8c2087d5e
9 changed files with 614 additions and 4 deletions
|
|
@ -131,4 +131,14 @@ extern int cache_insert(xce_scheduler_t* sched, xce_sched_obj_t* obj,
|
|||
*/
|
||||
extern void cache_clear(xce_scheduler_t* sched);
|
||||
|
||||
/*
|
||||
* xce_alloc_cache_clear_cb - the xce_core_cache_clear_cb_t (core.h)
|
||||
* adapter for cache_clear() above (scheduler-allocation spec, task 5.2
|
||||
* round 2, Req 7.2). Registered on the real xce_scheduler_t's core via
|
||||
* xce_core_set_cache_clear_cb() (main.c). See alloc_cache.c's own doc
|
||||
* comment on this function for the full rationale, including why it lives
|
||||
* here rather than in driver.c.
|
||||
*/
|
||||
extern void xce_alloc_cache_clear_cb(xce_sched_core_t* core);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue