feat(scheduler-allocation): add resreq fingerprinting for the cache

Adds rusage_hash to xce_primary_resreq_t (computed once by
parse_resreq_primary() via a new hash_rusages() helper, hashing
rusage content rather than raw struct bytes since resname is a
non-interned strdup'd pointer), the xce_resreq_fingerprint_t value
type, and resreq_fp on xce_primary_schedobj_t, populated once at real
job-ingest time in core_build_primary_schedobj().

Task 1.2 (scheduler-allocation spec). Requirement 7.1.

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:00:12 +00:00
parent d5d2c1caf5
commit 5a6706761d
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
9 changed files with 550 additions and 4 deletions

View file

@ -30,10 +30,26 @@ typedef struct {
struct xce_sched_obj_;
typedef struct xce_sched_obj_ xce_sched_obj_t;
/* Req 7.1 (scheduler-allocation spec): pre-computed resreq portion of the
* unsatisfiable-resreq cache key -- resource-usage shape only, independent
* of job identity (user/queue/project, which the full xce_cache_key_t adds
* at lookup time). Value object, immutable once computed, fitting in a
* single cache line. See requirements.md's Requirement 7 "New types". */
typedef struct {
xce_sched_obj_t* owner;
xce_primary_resreq_t* resreq;
xce_pendreason_t* reason;
int min_tasks;
int max_tasks;
uint32_t select_node_id; /* CSE-interned select-root node_id; 0 if select is NULL */
uint64_t rusage_hash; /* copied from xce_primary_resreq_t.rusage_hash */
} xce_resreq_fingerprint_t;
typedef struct {
xce_sched_obj_t* owner;
xce_primary_resreq_t* resreq;
xce_pendreason_t* reason;
/* Req 7.1: populated once on job ingest (core_build_primary_schedobj(),
* src/scheduler/src/core_events.c), read by every later cache lookup
* for this job so the fingerprint is never recomputed. */
xce_resreq_fingerprint_t resreq_fp;
} xce_primary_schedobj_t;
typedef struct {