Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 395 → Rev 396

/shark/trunk/ports/first/modules/grubstar.c
105,6 → 105,7
 
b->dline_timer = NIL;
 
b->last_reclaiming = 0;
b->avail += b->Q;
if (b->avail > b->Q) b->avail = b->Q;
165,11 → 166,10
b->vtimer = NIL;
if (b->current == NIL && iq_query_first(&(b->tasks)) == NIL && b->flags != GRUBSTAR_RECLAIMING) {
//event_need_reschedule();
event_need_reschedule();
TRACER_LOGEVENT(FTrace_EVT_server_reclaiming,1,(int)(b),0);
b->flags = GRUBSTAR_RECLAIMING;
lev->Uf -= b->Ub;
event_need_reschedule();
}
 
#ifdef GRUBSTAR_DEBUG
206,7 → 206,8
/* 2 */ TIMESPEC_A_GT_B(&t3, &t2) ) {
TIMESPEC_ASSIGN(&b->dline, acttime);
ADDUSEC2TIMESPEC(b->T, &b->dline);
b->avail=b->Q;
b->avail = b->Q;
b->last_reclaiming = 0;
}
 
if (b->flags==GRUBSTAR_RECLAIMING)
249,12 → 250,24
sys_end();
}
 
mul32div32to32(tx,(lev->U - lev->Uf),MAX_BANDWIDTH,b->last_reclaiming);
//Calculate reclaiming only one time
if (b->last_reclaiming == 0) {
 
b->avail -= tx - b->last_reclaiming;
//Geometrical n->+inf sum(tx*((lev->U - lev->Uf)/MAX_BANDWIDTH)^n)
mul32div32to32(tx,MAX_BANDWIDTH,(MAX_BANDWIDTH - lev->U + lev->Uf),b->last_reclaiming);
b->last_reclaiming -= tx;
if (b->last_reclaiming < 3) {
b->last_reclaiming = 0;
b->avail -= tx;
} else {
b->avail -= tx - b->last_reclaiming;
TRACER_LOGEVENT(FTrace_EVT_server_using_rec,3,(int)(b),b->last_reclaiming);
}
 
if (b->last_reclaiming > 0)
TRACER_LOGEVENT(FTrace_EVT_server_using_rec,3,(int)(b),b->last_reclaiming);
} else {
b->avail -= tx;
}
 
#ifdef GRUBSTAR_DEBUG
kern_printf("(GS:Cap p%d av=%d tx=%d rec=%d)", p, b->avail,(int)tx,b->last_reclaiming);
318,6 → 331,7
 
/* and the capacity */
b->avail = b->Q;
b->last_reclaiming = 0;
/* Tracer */
TRACER_LOGEVENT(FTrace_EVT_server_replenish,1,(int)(b),0);
626,7 → 640,7
if (Q< T && MAX_BANDWIDTH - lev->U > b) {
lev->U += b;
lev->Uf += b;
//lev->Uf += b; Start in Reclaiming
lev->freebudgets++;
lev->b[r].Q = Q;
633,7 → 647,7
lev->b[r].T = T;
lev->b[r].Ub = b;
lev->b[r].avail = Q;
lev->b[r].flags = GRUBSTAR_ACTIVE;
lev->b[r].flags = GRUBSTAR_RECLAIMING;
lev->b[r].loc_sched_id = scheduler_id;
lev->b[r].loc_sched_level = local_scheduler_level;
lev->b[r].last_reclaiming = 0;
659,7 → 673,7
mul32div32to32(MAX_BANDWIDTH,lev->b[budget].Q,lev->b[budget].T,b);
 
lev->U -= b;
lev->Uf -= b;
if (lev->b[budget].flags != GRUBSTAR_RECLAIMING) lev->Uf -= b;
 
lev->b[budget].Q = 0;
lev->b[budget].T = 0;
668,7 → 682,7
lev->b[budget].dline_timer = NIL;
lev->b[budget].avail = 0;
lev->b[budget].current = -1;
lev->b[budget].flags = GRUBSTAR_ACTIVE;
lev->b[budget].flags = GRUBSTAR_RECLAIMING;
lev->b[budget].last_reclaiming = 0;
 
TRACER_LOGEVENT(FTrace_EVT_server_remove,3,(int)(&(lev->b[budget])),budget);
686,7 → 700,7
mul32div32to32(MAX_BANDWIDTH,lev->b[budget].Q,lev->b[budget].T,b);
 
lev->U -= b;
lev->Uf -= b;
if (lev->b[budget].flags != GRUBSTAR_RECLAIMING) lev->Uf -= b;
 
lev->b[budget].Q = Q;
lev->b[budget].T = T;
693,7 → 707,7
mul32div32to32(MAX_BANDWIDTH,Q,T,lev->b[budget].Ub);
 
lev->U += lev->b[budget].Ub;
lev->Uf += lev->b[budget].Ub;
if (lev->b[budget].flags != GRUBSTAR_RECLAIMING) lev->Uf += lev->b[budget].Ub;
 
return 0;