feat(scheduler-sim-live-allocation): make plugin hook dispatch core-safe (task 1.2)
Re-types plugin_job_election()/plugin_prepare_allocation()/ plugin_commit_decision() from (void* arg, ...) to (xce_sched_core_t* core, ...), iterating core->plugins directly instead of deriving it from a normal-mode-only driver struct -- mirroring plugin_begin_session()/plugin_end_session()'s already-completed migration. Adds a new, honestly-typed xce_sched_plugin_t.core field, set by both plugin_register() (normal mode) and plugin_register_core() (simulation mode, closing a gap left since bug-1825 where this path set nothing). The existing plugin->sched field and its plugins/fcfs.c legacy consumer are left untouched. Necessarily updates the 4 existing normal-mode call sites (scheduler.c, resource.c, schedobj.c) to pass &(...->core) -- a C signature migration cannot keep the build green without touching every caller in the same commit; each fix is a minimal argument wrap with no algorithm change, matching design.md's own Implementation Notes for this component. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
89297dc825
commit
e8866641a6
18 changed files with 403 additions and 34 deletions
|
|
@ -86,6 +86,19 @@ typedef struct {
|
|||
* job_elect_fn"). Stays NULL for plugin categories that are neither
|
||||
* (allocator/limit plugins never set job_elect_fn). */
|
||||
xce_job_picker_iface_t* picker_iface;
|
||||
/* scheduler-sim-live-allocation spec, task 1.2 ("Plugin Hook
|
||||
* Dispatchers" / "Limit Plugin Core-Safe Matching"): an honestly-typed
|
||||
* reference to the shared core state, set by BOTH plugin_register()
|
||||
* (`plugin->core = &(sched->core);`) and plugin_register_core()
|
||||
* (`plugin->core = core;`) -- non-NULL after either registration path.
|
||||
* This is a NEW, separate field from `sched` above -- `sched` keeps its
|
||||
* existing meaning and consumers (still xce_scheduler_t*-flavored,
|
||||
* still set only by plugin_register(), still read by plugins/fcfs.c's
|
||||
* legacy job_elect_fn path) untouched. A plugin hook that needs shared
|
||||
* core state (e.g. plugins/limit.c's job-election/prepare-allocation
|
||||
* matching) reads `core`, never `sched`, so it works identically
|
||||
* whichever registration path registered it. */
|
||||
xce_sched_core_t* core;
|
||||
} xce_sched_plugin_t;
|
||||
|
||||
extern int plugin_register(void*, void*);
|
||||
|
|
@ -106,9 +119,19 @@ extern int plugin_job_state_change(void*, xce_sched_job_t*, uint32_t);
|
|||
* simulation-mode one. */
|
||||
extern int plugin_begin_session(xce_sched_core_t*);
|
||||
extern int plugin_end_session(xce_sched_core_t*);
|
||||
extern int plugin_commit_decision(void*, xce_decision_t*);
|
||||
extern int plugin_prepare_allocation(void*, xce_sched_ctx_t*);
|
||||
extern int plugin_job_election(void*, xce_sched_job_t*);
|
||||
/* plugin_commit_decision()/plugin_prepare_allocation()/plugin_job_election()
|
||||
* - relocated to xce_sched_core_t* (scheduler-sim-live-allocation spec,
|
||||
* task 1.2, mirroring plugin_begin_session()/plugin_end_session()'s own
|
||||
* identical bug-1681 relocation immediately above): each dispatch loop only
|
||||
* ever touches core->plugins, never anything else on xce_scheduler_t* -- so,
|
||||
* like plugin_register_core() below, these are callable from a driver with
|
||||
* no xce_scheduler_t* (the simulation driver). Does NOT change
|
||||
* plugin_hooks_t's own hook signatures (job_election_hook/
|
||||
* prepare_allocation_hook/commit_hook keep their existing `(void* arg, ...)`
|
||||
* shape -- `arg` there is the plugin instance, not the driver/core struct). */
|
||||
extern int plugin_commit_decision(xce_sched_core_t*, xce_decision_t*);
|
||||
extern int plugin_prepare_allocation(xce_sched_core_t*, xce_sched_ctx_t*);
|
||||
extern int plugin_job_election(xce_sched_core_t*, xce_sched_job_t*);
|
||||
extern int plugin_job_rusage_update(void*, xce_sched_job_t*,
|
||||
xce_job_rusages_t*);
|
||||
extern int register_fcfs(void*);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue