53,6 → 53,8 |
LEVEL l; /* Current GRUBSTAR level */ |
int loc_sched_id; /* Local scheduler id */ |
LEVEL loc_sched_level; /* Local scheduler level */ |
|
int last_reclaiming; |
|
PID current; /* the task currently put in execution */ |
int flags; |
78,8 → 80,6 |
bandwidth_t U; /*+ the used bandwidth by the server +*/ |
bandwidth_t Uf; /*+ the actual used bandwidth by the server +*/ |
|
int last_reclaiming; |
|
int cap_lev; |
|
LEVEL scheduling_level; |
120,7 → 120,7 |
if (b->current == NIL && b->flags) { |
if (iq_query_first(&(b->tasks)) != NIL) { |
JOB_TASK_MODEL job; |
|
|
p = iq_getfirst(&b->tasks); |
|
#ifdef GRUBSTAR_DEBUG |
131,7 → 131,6 |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
|
b->current = p; |
|
|
job_task_default_model(job, b->dline); |
job_task_def_noexc(job); |
211,27 → 210,25 |
TIMESPEC_ASSIGN(&b->dline, acttime); |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
b->avail=b->Q; |
if (b->flags==GRUBSTAR_RECLAIMING) { |
bandwidth_t bw; |
|
} |
|
if (b->flags==GRUBSTAR_RECLAIMING) { |
bandwidth_t bw; |
|
bw = (MAX_BANDWIDTH / b->T) * b->Q; |
bw = (MAX_BANDWIDTH / b->T) * b->Q; |
|
lev->Uf += bw; |
lev->Uf += bw; |
|
#ifdef grubSTAR_DEBUG |
kern_printf("BW=%ld, U=%u, Uf=%u",(long)bw, lev->U, lev->Uf); |
#endif |
} |
#ifdef grubSTAR_DEBUG |
kern_printf("BW=%ld, U=%u, Uf=%u",(long)bw, lev->U, lev->Uf); |
#endif |
|
} |
|
b->flags=GRUBSTAR_ACTIVE; |
b->flags=GRUBSTAR_ACTIVE; |
|
} else { |
|
SUBTIMESPEC(&b->dline, &t3, &t2); |
b->vtimer = kern_event_post(&t2, GRUBSTAR_ANC, b); |
} |
|
/* record the current task inserted in the master module */ |
b->current = p; |
|
247,7 → 244,13 |
struct timespec ty; |
TIME tx; |
struct budget_struct *b = &lev->b[lev->tb[p]]; |
TIME t; |
struct timespec t2,t3; |
|
|
if (b->vtimer!=NIL) kern_event_delete(b->vtimer); |
b->vtimer=NIL; |
|
if (lev->cap_lev != NIL && b->current == p) { |
kern_event_delete(lev->cap_lev); |
lev->cap_lev = NIL; |
259,9 → 262,9 |
kern_printf("(GS:Cap p%d av=%d)", p, b->avail); |
#endif |
|
lev->last_reclaiming = (unsigned int)((long long)(tx) * (long long)(lev->U - lev->Uf)/MAX_BANDWIDTH); |
b->last_reclaiming = (unsigned int)((long long)(tx) * (long long)(lev->U - lev->Uf)/MAX_BANDWIDTH); |
|
b->avail -= tx - lev->last_reclaiming; |
b->avail -= tx - b->last_reclaiming; |
|
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:Cap p%d av=%d Uf=%u U=%u, tx=%d)", p, b->avail,lev->Uf, lev->U,(int)tx); |
277,8 → 280,13 |
|
if (b->flags == GRUBSTAR_NOACTIVE && b->dline_timer == NIL) { |
b->dline_timer=kern_event_post(&b->dline, GRUBSTAR_deadline_timer_hardreservation, b); |
} else { |
t = (b->T * b->avail) / b->Q; |
t3.tv_sec = t / 1000000; |
t3.tv_nsec = (t % 1000000) * 1000; |
SUBTIMESPEC(&b->dline, &t3, &t2); |
b->vtimer = kern_event_post(&t2, GRUBSTAR_ANC, b); |
} |
|
} |
|
|
330,6 → 338,15 |
|
/* and the capacity */ |
b->avail = b->Q; |
|
if (b->flags == GRUBSTAR_RECLAIMING) { |
bandwidth_t bw; |
|
bw = (MAX_BANDWIDTH / b->T) * b->Q; |
lev->Uf += bw; |
|
} |
|
b->flags = GRUBSTAR_ACTIVE; |
|
if (b->dline_timer!=NIL) { |
484,6 → 501,7 |
// L'evento di capacità va cancellato perchè sarà ripristinato nella successiva dispatch |
/* we have to check if the capacity is still available */ |
if (b->flags) { |
|
/* there is capacity available, maybe it is simply a preemption; |
the task have to return to the ready queue */ |
level_table[ lev->scheduling_level ]-> |
571,7 → 589,8 |
lev->b[i].avail = 0; |
lev->b[i].current = -1; |
lev->b[i].flags = GRUBSTAR_ACTIVE; |
lev->b[i].l=l; |
lev->b[i].l = l; |
lev->b[i].last_reclaiming = 0; |
iq_init(&lev->b[i].tasks, NULL, 0); |
} |
|
583,7 → 602,6 |
|
lev->U = 0; |
lev->Uf = 0; |
lev->last_reclaiming = 0; |
lev->cap_lev = NIL; |
lev->scheduling_level = master; |
|
620,7 → 638,8 |
lev->b[r].flags = GRUBSTAR_ACTIVE; |
lev->b[r].loc_sched_id = scheduler_id; |
lev->b[r].loc_sched_level = local_scheduler_level; |
|
lev->b[r].last_reclaiming = 0; |
|
return r; |
} |
else |
677,12 → 696,12 |
|
} |
|
int GRUBSTAR_get_last_reclaiming(LEVEL l) |
int GRUBSTAR_get_last_reclaiming(LEVEL l, PID p) |
{ |
|
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
|
return lev->last_reclaiming; |
return lev->b[lev->tb[p]].last_reclaiming; |
|
} |
|