154,7 → 154,7 |
GRUBSTAR_level_des *lev=(GRUBSTAR_level_des *)level_table[b->l]; |
|
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:Rec:"); |
//kern_printf("(GS:Rec:"); |
#endif |
|
b->vtimer = NIL; |
223,7 → 223,7 |
if (b->vtimer!=NIL) kern_event_delete(b->vtimer); |
b->vtimer=NIL; |
|
if (lev->cap_lev != NIL && b->current == p) { |
if (lev->cap_lev != NIL) { |
kern_event_delete(lev->cap_lev); |
lev->cap_lev = NIL; |
} |
236,7 → 236,7 |
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); |
//kern_printf("(GS:Cap p%d av=%d Uf=%u U=%u, tx=%d)", p, b->avail, lev->Uf, lev->U,(int)tx); |
#endif |
|
if (b->avail <= 0) b->flags = GRUBSTAR_NOACTIVE; |
281,7 → 281,9 |
|
GRUBSTAR_level_des *lev = l; |
lev->cap_lev = NIL; |
|
#ifdef GRUBSTAR_DEBUG |
kern_printf("(*)"); |
#endif |
event_need_reschedule(); |
|
} |
289,15 → 291,12 |
static int GRUBSTAR_private_eligible(LEVEL l, PID p) |
{ |
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
struct budget_struct *b = &lev->b[lev->tb[p]]; |
struct budget_struct *b=&lev->b[lev->tb[p]]; |
JOB_TASK_MODEL job; |
|
if (b->current == p) { |
if ( TIMESPEC_A_LT_B(&b->dline, &schedule_time)) { |
|
if ( TIMESPEC_A_LT_B(&b->dline, &schedule_time)) { |
|
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:Eli:%d)",p); |
#endif |
|
if (lev->cap_lev!=NIL) { |
kern_event_delete(lev->cap_lev); |
339,8 → 338,7 |
|
return -1; |
|
} |
} |
} |
|
return 0; |
|
444,16 → 442,18 |
be extracted! */ |
|
/* ... then, we dispatch it to the master level */ |
level_table[ lev->scheduling_level ]-> |
private_dispatch(lev->scheduling_level,p,nostop); |
if (!nostop) |
level_table[ lev->scheduling_level ]-> |
private_dispatch(lev->scheduling_level,p,nostop); |
|
TIMESPEC_ASSIGN(&ty, &schedule_time); |
TIMESPEC_ASSIGN(&lev->cap_lasttime, &schedule_time); |
|
/* ...and finally, we have to post a capacity event */ |
if (!nostop) { |
TIMESPEC_ASSIGN(&ty, &schedule_time); |
TIMESPEC_ASSIGN(&lev->cap_lasttime, &schedule_time); |
ADDUSEC2TIMESPEC(lev->b[lev->tb[p]].avail,&ty); |
lev->cap_lev = kern_event_post(&ty,capacity_handler, lev); |
} |
|
ADDUSEC2TIMESPEC(lev->b[lev->tb[exec]].avail,&ty); |
lev->cap_lev = kern_event_post(&ty,capacity_handler, lev); |
|
|
} |
|
460,16 → 460,27 |
static void GRUBSTAR_private_epilogue(LEVEL l, PID p) |
{ |
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
struct budget_struct *b = &lev->b[lev->tb[p]]; |
|
struct budget_struct *b; |
int skip_epilog; |
skip_epilog=0; |
|
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:Epi:%d)",p); |
kern_printf("(GS:Epi:%d)",p); |
#endif |
|
if (p==b->current) { |
if (p==exec) b = &lev->b[lev->tb[p]]; |
else if (lev->tb[exec]!=NIL) { |
b = &lev->b[lev->tb[exec]]; |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(ex%d, c%d)***************************", exec, p); |
#endif |
p=exec; |
skip_epilog=1; |
} |
else return; |
|
GRUBSTAR_account_capacity(lev,p); |
|
GRUBSTAR_account_capacity(lev,p); |
// 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) { |
476,13 → 487,17 |
|
/* there is capacity available, maybe it is simply a preemption; |
the task have to return to the ready queue */ |
level_table[ lev->scheduling_level ]-> |
private_epilogue(lev->scheduling_level,p); |
if (!skip_epilog) |
level_table[ lev->scheduling_level ]-> |
private_epilogue(lev->scheduling_level,p); //else kern_printf("(SP)"); |
|
} else { |
/* we kill the current activation */ |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:HRExt:%d",p); |
#endif |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level, p); |
private_extract(lev->scheduling_level, p); |
|
iq_insertfirst(p, &b->tasks); |
b->current = NIL; |
489,8 → 504,6 |
|
} |
|
} |
|
} |
|
static int GRUBSTAR_public_message(LEVEL l, PID p, void *m) |