* pointers to all Xen UNIT structures for iterating through
*/
struct list_head unit_list;
+
+ /**
+ * scheduling house keeping variables
+ */
+ unsigned int sched_index;
+ s_time_t next_switch_time;
} a653sched_priv_t;
/**************************************************************************
bool tasklet_work_scheduled)
{
struct sched_unit *new_task = NULL;
- static unsigned int sched_index = 0;
- static s_time_t next_switch_time;
a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
unsigned long flags;
/* time to enter a new major frame
* the first time this function is called, this will be true */
/* start with the first domain in the schedule */
- sched_index = 0;
+ sched_priv->sched_index = 0;
sched_priv->next_major_frame = now + sched_priv->major_frame;
- next_switch_time = now + sched_priv->schedule[0].runtime;
+ sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
}
else
{
- while ( (now >= next_switch_time)
- && (sched_index < sched_priv->num_schedule_entries) )
+ while ( (now >= sched_priv->next_switch_time) &&
+ (sched_priv->sched_index < sched_priv->num_schedule_entries) )
{
/* time to switch to the next domain in this major frame */
- sched_index++;
- next_switch_time += sched_priv->schedule[sched_index].runtime;
+ sched_priv->sched_index++;
+ sched_priv->next_switch_time +=
+ sched_priv->schedule[sched_priv->sched_index].runtime;
}
}
* If we exhausted the domains in the schedule and still have time left
* in the major frame then switch next at the next major frame.
*/
- if ( sched_index >= sched_priv->num_schedule_entries )
- next_switch_time = sched_priv->next_major_frame;
+ if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+ sched_priv->next_switch_time = sched_priv->next_major_frame;
/*
* If there are more domains to run in the current major frame, set
* Otherwise, set new_task equal to the address of the idle task's
* sched_unit structure.
*/
- new_task = (sched_index < sched_priv->num_schedule_entries)
- ? sched_priv->schedule[sched_index].unit
+ new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+ ? sched_priv->schedule[sched_priv->sched_index].unit
: IDLETASK(cpu);
/* Check to see if the new task can be run (awake & runnable). */
* Return the amount of time the next domain has to run and the address
* of the selected task's UNIT structure.
*/
- prev->next_time = next_switch_time - now;
+ prev->next_time = sched_priv->next_switch_time - now;
prev->next_task = new_task;
new_task->migrated = false;