SMP - CPU local run queues

- each CPU has its own runqueues

- processes on BSP are put on the runqueues later after a switch to
  the final stack when cpuid works to avoid special cases

- enqueue() and dequeue() use the run queues of the cpu the process is
  assigned to

- pick_proc() uses the local run queues

- printing of per-CPU run queues ('2') on serial console
This commit is contained in:
Tomas Hruby
2010-09-15 14:10:18 +00:00
parent ad73a4f50c
commit fac5fbfdbf
10 changed files with 134 additions and 60 deletions

View File

@@ -14,11 +14,14 @@
#define MAX_LOOP (NR_PROCS + NR_TASKS)
PUBLIC int
runqueues_ok(void)
PUBLIC int runqueues_ok_cpu(unsigned cpu)
{
int q, l = 0;
register struct proc *xp;
struct proc **rdy_head, **rdy_tail;
rdy_head = get_cpu_var(cpu, run_q_head);
rdy_tail = get_cpu_var(cpu, run_q_tail);
for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) {
xp->p_found = 0;
@@ -109,6 +112,33 @@ runqueues_ok(void)
return 1;
}
#ifdef CONFIG_SMP
PRIVATE int runqueues_ok_all(void)
{
unsigned c;
for (c = 0 ; c < ncpus; c++) {
if (!runqueues_ok_cpu(c))
return 0;
}
return 1;
}
PUBLIC int runqueues_ok(void)
{
return runqueues_ok_all();
}
#else
PUBLIC int runqueues_ok(void)
{
return runqueues_ok_cpu(0);
}
#endif
PUBLIC char *
rtsflagstr(const int flags)
{