hw: do inter-processor interrupt only when needed

The processor scheduler can determine without much overhead wether
the currently scheduled client becomes out-dated due to the insertion
of another client. This can be used to safe inter-processor interrupts
when a remote insertion doesn't imply an update of the currently
scheduled client.

fix #1088
This commit is contained in:
Martin Stein 2014-03-11 13:31:25 +01:00 committed by Norman Feske
parent 18cee192e2
commit 8ce197d7fa
2 changed files with 24 additions and 6 deletions

View File

@ -61,13 +61,17 @@ void Kernel::Processor_client::_schedule() { __processor->schedule(this); }
void Kernel::Processor::schedule(Processor_client * const client)
{
/* schedule processor client */
_scheduler.insert(client);
if (_id != executing_id()) {
/* let the processor notice the change immediately */
if (_id != executing_id() && !_ip_interrupt_pending) {
pic()->trigger_ip_interrupt(_id);
_ip_interrupt_pending = true;
/* remote add client and let target processor notice it if necessary */
if (_scheduler.insert_and_check(client) && !_ip_interrupt_pending) {
pic()->trigger_ip_interrupt(_id);
_ip_interrupt_pending = true;
}
} else {
/* add client locally */
_scheduler.insert(client);
}
}

View File

@ -279,6 +279,20 @@ class Kernel::Scheduler
_items[i->priority()].insert_tail(i);
}
/**
* Include item in scheduling and check wether an update is needed
*
* \param item targeted item
*
* \return wether the current occupant is out-dated after insertion
*/
bool insert_and_check(T * const item)
{
insert(item);
if (!_occupant) { return true; }
return item->priority() > _occupant->priority();
}
/**
* Exclude 'i' from scheduling
*/