feat(scheduler-allocation): add forward-compatible allocation-mode field

Adds xce_alloc_mode_t (XCE_ALLOC_NORMAL=0, XCE_ALLOC_PREEMPT, with
commented-out RESERVE/BACKFILL placeholders) and alloc_mode on
xce_sched_ctx_t, zero-defaulted by sched_ctx_init()'s existing
memset. Purely additive: nothing branches on the field yet -- this
spec only declares the extension point scheduler-preemption needs.

Task 1.3 (scheduler-allocation spec). Requirement 9.5.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYdtrEWWZfKRRGED7raEYg
This commit is contained in:
Rongsong Shen 2026-09-04 15:17:30 +00:00
parent 5a6706761d
commit d8b5cf8718
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 52 additions and 1 deletions

View file

@ -140,6 +140,22 @@ typedef struct {
host_eval_ctx_t* host_eval_ctx; /* cached per-session; NULL until first use */
} xce_sched_worker_t;
/* Req 9.5 (scheduler-allocation spec): forward-compatible resource-pool-mode
* extension point on xce_sched_ctx_t. v1 (this spec) implements only
* XCE_ALLOC_NORMAL -- no allocation code path branches on any other value.
* XCE_ALLOC_PREEMPT's actual resource-borrowing behavior belongs to the
* scheduler-preemption spec; the "Future:" entries are scaffolding for
* later resource-pool modes (e.g. reservation-aware backfill) and are not
* implemented by anything yet. */
typedef enum {
XCE_ALLOC_NORMAL = 0, /* only truly free resources */
XCE_ALLOC_PREEMPT, /* count preemptible job resources as available */
/* Future:
* XCE_ALLOC_RESERVE, // count reserved-but-idle resources as available
* XCE_ALLOC_BACKFILL, // count reserved + preemptible resources
*/
} xce_alloc_mode_t;
typedef struct {
void* sched;
xce_sched_worker_t* worker;
@ -155,6 +171,10 @@ typedef struct {
xce_sched_alloc_req_t alloc_req;
xce_job_alloc_t* alloc;
xce_pendreason_t* reason;
/* Req 9.5: defaults to XCE_ALLOC_NORMAL via sched_ctx_init()'s existing
* memset(ctx, 0, sizeof(*ctx)) -- XCE_ALLOC_NORMAL is the enum's zero
* value, so no explicit assignment is needed. */
xce_alloc_mode_t alloc_mode;
} xce_sched_ctx_t;
typedef struct {