Changeset 3260ada in mainline
- Timestamp:
- 2006-02-04T21:08:45Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e72b0a3
- Parents:
- 04225a7
- Location:
- generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/cpu.h
r04225a7 r3260ada 58 58 link_t timeout_active_head; 59 59 60 #ifdef CONFIG_SMP61 atomic_t kcpulbstarted;62 waitq_t kcpulb_wq;63 #endif /* CONFIG_SMP */64 65 60 /** 66 61 * Processor ID assigned by kernel. -
generic/src/cpu/cpu.c
r04225a7 r3260ada 68 68 spinlock_initialize(&cpus[i].lock, "cpu_t.lock"); 69 69 70 #ifdef CONFIG_SMP71 waitq_initialize(&cpus[i].kcpulb_wq);72 #endif /* __SMP */73 74 70 for (j = 0; j < RQ_COUNT; j++) { 75 71 spinlock_initialize(&cpus[i].rq[j].lock, "rq_t.lock"); -
generic/src/proc/scheduler.c
r04225a7 r3260ada 134 134 135 135 if (n == 0) { 136 #ifdef CONFIG_SMP137 /*138 * If the load balancing thread is not running, wake it up and139 * set CPU-private flag that the kcpulb has been started.140 */141 if (test_and_set(&CPU->kcpulbstarted) == 0) {142 waitq_wakeup(&CPU->kcpulb_wq, 0);143 goto loop;144 }145 #endif /* CONFIG_SMP */146 147 136 /* 148 137 * For there was nothing to run, the CPU goes to sleep 149 138 * until a hardware interrupt or an IPI comes. 150 139 * This improves energy saving and hyperthreading. 151 * On the other hand, several hardware interrupts can be ignored.152 140 */ 153 141 cpu_sleep(); … … 482 470 loop: 483 471 /* 484 * Sleep until there's some work to do.472 * Work in 1s intervals. 485 473 */ 486 waitq_sleep(&CPU->kcpulb_wq);474 thread_sleep(1); 487 475 488 476 not_satisfied: … … 579 567 spinlock_lock(&t->lock); 580 568 #ifdef KCPULB_VERBOSE 581 printf("kcpulb%d: TID %d -> cpu%d, nrdy=%d, avg=%d\n", CPU->id, t->tid, CPU->id, CPU->nrdy, nrdy/ config.cpu_active);569 printf("kcpulb%d: TID %d -> cpu%d, nrdy=%d, avg=%d\n", CPU->id, t->tid, CPU->id, CPU->nrdy, atomic_get(&nrdy) / config.cpu_active); 582 570 #endif 583 571 t->flags |= X_STOLEN; … … 607 595 */ 608 596 scheduler(); 609 } 610 else { 597 } else { 611 598 /* 612 599 * We failed to migrate a single thread. 613 * Something more sophisticated should be done.600 * Give up this turn. 614 601 */ 615 scheduler();602 goto loop; 616 603 } 617 604 … … 619 606 620 607 satisfied: 621 /*622 * Tell find_best_thread() to wake us up later again.623 */624 atomic_set(&CPU->kcpulbstarted,0);625 608 goto loop; 626 609 } … … 656 639 continue; 657 640 } 658 printf(" Rq %d: ", i);641 printf("\tRq %d: ", i); 659 642 for (cur=r->rq_head.next; cur!=&r->rq_head; cur=cur->next) { 660 643 t = list_get_instance(cur, thread_t, rq_link);
Note:
See TracChangeset
for help on using the changeset viewer.