Subversion Repositories HelenOS

Rev

Rev 8 | Rev 15 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8 Rev 10
Line 44... Line 44...
44
#include <list.h>
44
#include <list.h>
45
#include <typedefs.h>
45
#include <typedefs.h>
46
#include <time/clock.h>
46
#include <time/clock.h>
47
#include <list.h>
47
#include <list.h>
48
#include <config.h>
48
#include <config.h>
49
 
-
 
50
#ifdef __SMP__
-
 
51
#include <arch/interrupt.h>
49
#include <arch/interrupt.h>
52
#include <arch/apic.h>
50
#include <smp/ipi.h>
53
#endif /* __SMP__ */
-
 
54
 
51
 
55
char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
52
char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
56
 
53
 
57
spinlock_t threads_lock;
54
spinlock_t threads_lock;
58
link_t threads_head;
55
link_t threads_head;
Line 120... Line 117...
120
    spinlock_lock(&nrdylock);
117
    spinlock_lock(&nrdylock);
121
    avg = ++nrdy / config.cpu_active;
118
    avg = ++nrdy / config.cpu_active;
122
    spinlock_unlock(&nrdylock);
119
    spinlock_unlock(&nrdylock);
123
 
120
 
124
    spinlock_lock(&cpu->lock);
121
    spinlock_lock(&cpu->lock);
125
    if ((++cpu->nrdy) > avg && (config.cpu_active == config.cpu_count)) {
122
    if ((++cpu->nrdy) > avg) {
126
        /*
123
        /*
127
         * If there are idle halted CPU's, this will wake them up.
124
         * If there are idle halted CPU's, this will wake them up.
128
         */
125
         */
129
        #ifdef __SMP__
-
 
130
        ipi_broadcast(VECTOR_WAKEUP_IPI);
126
        ipi_broadcast(VECTOR_WAKEUP_IPI);
131
        #endif /* __SMP__  */
-
 
132
    }  
127
    }  
133
    spinlock_unlock(&cpu->lock);
128
    spinlock_unlock(&cpu->lock);
134
   
129
   
135
    cpu_priority_restore(pri);
130
    cpu_priority_restore(pri);
136
}
131
}