scheduling using real slots number

This commit is contained in:
Rongsong Shen 2025-12-30 18:13:15 +08:00
parent 8db4458375
commit 780e9fb313
22 changed files with 980 additions and 105 deletions

View file

@ -37,6 +37,7 @@ extern void kvmgr_fini(kvmgr_t*);
extern void* kvmgr_lock(kvmgr_t*, void*, int);
extern void* kvmgr_lock_byid(kvmgr_t*, int, int);
extern int32_t kvmgr_add(kvmgr_t*, void*, void*);
extern int32_t kvmgr_put(kvmgr_t*, void*, int, void*);
extern void kvmgr_del(kvmgr_t*, void*);
extern int kvmgr_iter(kvmgr_t*, zarray_iter_skip_fn_t, xlist_t*, void*);
@ -44,6 +45,7 @@ extern int resmgr_init(resmgr_t*, int, int, zarray_item_killer_t);
extern void resmgr_fini(resmgr_t*);
extern int32_t resmgr_add_res(resmgr_t*, xce_resource_t*);
extern xce_resource_t* resmgr_lockres(resmgr_t*, char*, int);
extern xce_resource_t* resmgr_lock_byid(resmgr_t*, int, int);
extern void resmgr_del_res(resmgr_t*, xce_resource_t*);
extern int resmgr_iter(resmgr_t*, xlist_t*, void*);

View file

@ -6,6 +6,7 @@
#define PREASON_BAD_RESREQ (1)
#define PREASON_NO_RESOURCE (2)
#define PREASON_MATCH_FAIL (3)
extern void erase_job_preason(xce_job_preason_t*);
extern int add_job_preason(xce_job_preason_t*, int, char*, char*);

View file

@ -257,7 +257,7 @@ typedef struct {
typedef struct {
char* resname;
char* reserve;
uint32_t instid;
uint64_t instid;
double value;
uint64_t from;
int64_t duration;
@ -269,6 +269,14 @@ typedef struct {
double used;
} res_usage_t;
typedef struct {
uint64_t instid;
char* resname;
int residx;
double used;
double reserved;
} xce_res_account_t;
typedef struct {
xce_worker_t host;
char hostkey[XCE_MAXKEY_LEN];
@ -283,12 +291,28 @@ typedef struct {
xce_alloc_t** allocs;
} xce_host_alloc_t;
typedef struct {
char* host;
int naccount;
xce_res_account_t** accounts;
} xce_host_account_t;
typedef struct {
uint64_t jobid;
int nhosts;
xce_host_alloc_t** allocs;
int nres_shared;
xce_alloc_t** allocs_shared;
} xce_job_alloc_t;
typedef struct {
uint64_t jobid;
int nhosts;
xce_host_account_t** accounts;
int nres_shared;
xce_res_account_t** accounts_shared;
} xce_job_account_t;
typedef struct {
int njobs;
xce_job_alloc_t** allocs;
@ -440,6 +464,7 @@ typedef struct {
job_pidinfo_t* pidinfo;
unsigned int state;
xce_job_alloc_t* allocs;
xce_job_account_t* accounts;
int run_time;
xce_job_runusage_t* run_usage;
job_exitinfo_t* exit_info;

View file

@ -3,13 +3,15 @@
#define _XCEALLOC_H_ 1
#include <stdarg.h>
#include <stdint.h>
#include "xce/types.h"
extern xce_alloc_t* make_alloc(char*, char*, int, float, int);
extern xce_alloc_t* make_alloc(char*, char*, uint64_t, float, int);
extern xce_host_alloc_t* make_host_alloc(char*, int, xce_alloc_t**);
extern xce_job_alloc_t* make_job_alloc(uint64_t, int, xce_host_alloc_t**);
extern xce_alloc_t** make_allocs(int, ...);
extern xce_host_alloc_t** make_host_allocs(int, ...);
extern xce_job_account_t* make_job_account(xce_job_alloc_t*);
#endif

View file

@ -2,7 +2,10 @@
#define __XLIST_H__ 1
#include <stdarg.h>
typedef int (*xlist_iter_fn_t)(void*, void*);
typedef int (*xlist_find_fn_t)(void*, va_list);
typedef struct {
int count;
@ -13,9 +16,10 @@ typedef struct {
typedef int (*xlist_action_fn_t)(xlist_t*, void*);
extern int xlist_init(xlist_t*, int);
extern int xlist_store(xlist_t*, void*);
extern void xlist_clear(xlist_t*);
extern int xlist_iter(xlist_t*, xlist_iter_fn_t, void*);
extern void xlist_fini(xlist_t*);
extern int xlist_init(xlist_t*, int);
extern int xlist_store(xlist_t*, void*);
extern void xlist_clear(xlist_t*);
extern int xlist_iter(xlist_t*, xlist_iter_fn_t, void*);
extern void* xlist_find(xlist_t*, xlist_find_fn_t, ...);
extern void xlist_fini(xlist_t*);
#endif

View file

@ -2,12 +2,15 @@
#define _ZARRAY_H_ 1
#include <stdarg.h>
#include "mylock.h"
#include "xlist.h"
typedef void (*zarray_item_killer_t)(void*);
typedef int (*zarray_iter_fn_t)(void*, void*);
typedef int (*zarray_iter_skip_fn_t)(void*);
typedef int (*zarray_find_cond_fn_t)(void*, va_list);
typedef struct {
mylock_t lock;
@ -29,6 +32,7 @@ extern int zarray_put(zarray_t*, int, void*);
extern int zarray_put_ex(zarray_t*, int, int*, void**);
extern int zarray_get_ex(zarray_t*, int, int*, void**);
extern void* zarray_get(zarray_t*, int);
extern void* zarray_find(zarray_t*, zarray_find_cond_fn_t, ...);
extern void zarray_fini(zarray_t*);
#endif