--- libaitsched/src/hooks.c 2012/08/08 08:25:39 1.12 +++ libaitsched/src/hooks.c 2012/08/08 23:00:05 1.12.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.12 2012/08/08 08:25:39 misho Exp $ +* $Id: hooks.c,v 1.12.2.1 2012/08/08 23:00:05 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -958,10 +958,10 @@ sched_hook_fetch(void *root, void *arg __unused) } /* put regular task priority task to ready queue, - if there is no ready task or reach max missing hit events */ + if there is no ready task or reach max missing hit for regular task */ if ((task = TAILQ_FIRST(&r->root_task))) { - if (!TAILQ_FIRST(&r->root_ready) || r->root_task_miss > r->root_miss) { - r->root_task_miss ^= r->root_task_miss; + if (!TAILQ_FIRST(&r->root_ready) || r->root_miss >= TASK_VAL(task)) { + r->root_miss ^= r->root_miss; #ifdef HAVE_LIBPTHREAD pthread_mutex_lock(&r->root_mtx[taskTASK]); @@ -979,9 +979,9 @@ sched_hook_fetch(void *root, void *arg __unused) pthread_mutex_unlock(&r->root_mtx[taskREADY]); #endif } else - r->root_task_miss++; + r->root_miss++; } else - r->root_task_miss ^= r->root_task_miss; + r->root_miss ^= r->root_miss; /* OK, lets get ready task !!! */ task = TAILQ_FIRST(&r->root_ready);