6,9 → 6,8 |
* Paolo Gai <pj@gandalf.sssup.it> |
* |
* Authors : |
* Paolo Gai <pj@gandalf.sssup.it> |
* Massimiliano Giorgi <massy@gandalf.sssup.it> |
* Luca Abeni <luca@gandalf.sssup.it> |
* Giacomo Guidi <giacomo@gandalf.sssup.it> |
* Michael Trimarchi <trimarchi@gandalf.sssup.it> |
* (see the web pages for full authors list) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
76,9 → 75,11 |
|
int tb[MAX_PROC]; /* link task->budget (used in guest_end) */ |
|
bandwidth_t U; /*+ the used bandwidth by the server +*/ |
bandwidth_t Uf; /*+ the actual used bandwidth by the server +*/ |
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; |
165,7 → 166,7 |
#endif |
|
b->vtimer = NIL; |
if (b->current == NIL && iq_query_first(&(b->tasks)) == NIL) { |
if (b->current == NIL && iq_query_first(&(b->tasks)) == NIL && b->flags != GRUBSTAR_RECLAIMING) { |
bandwidth_t bw; |
|
b->flags=GRUBSTAR_RECLAIMING; |
257,8 → 258,10 |
kern_printf("(GS:Cap p%d av=%d)", p, b->avail); |
#endif |
|
b->avail -= (tx-(unsigned int)((long long)tx * (long long)(lev->U - lev->Uf)/MAX_BANDWIDTH)); |
lev->last_reclaiming = (unsigned int)((long long)(tx) * (long long)(lev->U - lev->Uf)/MAX_BANDWIDTH); |
|
b->avail -= tx - lev->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,tx); |
#endif |
493,6 → 496,38 |
|
} |
|
static int GRUBSTAR_public_message(LEVEL l, PID p, void *m) |
{ |
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
struct budget_struct *b = &lev->b[lev->tb[p]]; |
|
switch((long)(m)) { |
|
case (long)(NULL): |
|
if (b->current == NIL && iq_query_first(&(b->tasks)) == NIL && b->flags != GRUBSTAR_RECLAIMING) { |
bandwidth_t bw; |
|
b->flags = GRUBSTAR_RECLAIMING; |
|
bw = (MAX_BANDWIDTH / b->T) * b->Q; |
|
lev->Uf -= bw; |
|
} |
|
break; |
|
case 1: |
|
break; |
|
} |
|
return 0; |
|
} |
|
/* Registration functions }*/ |
|
LEVEL GRUBSTAR_register_level(int n, LEVEL master) |
516,6 → 551,7 |
lev->l.private_epilogue = GRUBSTAR_private_epilogue; |
|
lev->l.public_guarantee = GRUBSTAR_public_guarantee; |
lev->l.public_message = GRUBSTAR_public_message; |
|
lev->b = (struct budget_struct *)kern_alloc(sizeof(struct budget_struct)*n); |
|
540,6 → 576,7 |
|
lev->U = 0; |
lev->Uf = 0; |
lev->last_reclaiming = 0; |
lev->cap_lev = NIL; |
lev->scheduling_level = master; |
|
633,6 → 670,15 |
|
} |
|
int GRUBSTAR_get_last_reclaiming(LEVEL l) |
{ |
|
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
|
return lev->last_reclaiming; |
|
} |
|
int GRUBSTAR_is_active(LEVEL l, int budget) |
{ |
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |