Changeset 4ffa9e0 in mainline for src/proc/thread.c


Ignore:
Timestamp:
2005-02-23T11:48:52Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3418c41
Parents:
b109ebb
Message:

New IPI for waking up idle CPU's halted in scheduler.
Added architecture-independent ipi_broadcast().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/proc/thread.c

    rb109ebb r4ffa9e0  
    4646#include <time/clock.h>
    4747#include <list.h>
     48#include <config.h>
     49
     50#ifdef __SMP__
     51#include <arch/interrupt.h>
     52#include <arch/apic.h>
     53#endif /* __SMP__ */
    4854
    4955char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
     
    8995        runq_t *r;
    9096        pri_t pri;
    91         int i;
     97        int i, avg, send_ipi = 0;
    9298
    9399        pri = cpu_priority_high();
     
    113119
    114120        spinlock_lock(&nrdylock);
    115         nrdy++;
     121        avg = ++nrdy / config.cpu_active;
    116122        spinlock_unlock(&nrdylock);
    117123
    118124        spinlock_lock(&cpu->lock);
    119         cpu->nrdy++;
     125        if ((++cpu->nrdy) > avg && (config.cpu_active == config.cpu_count)) {
     126                /*
     127                 * If there are idle halted CPU's, this will wake them up.
     128                 */
     129                #ifdef __SMP__
     130                l_apic_broadcast_custom_ipi(VECTOR_WAKEUP_IPI);
     131                #endif /* __SMP__  */
     132        }       
    120133        spinlock_unlock(&cpu->lock);
    121134   
Note: See TracChangeset for help on using the changeset viewer.