Changeset 444ec64 in mainline
- Timestamp:
- 2006-02-05T14:15:51Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 328e0d3
- Parents:
- 248fc1a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/proc/scheduler.c
r248fc1a r444ec64 132 132 * until a hardware interrupt or an IPI comes. 133 133 * This improves energy saving and hyperthreading. 134 * 135 * - we might get an interrupt here that makes some thread runnable, 136 * in such a case we must wait for the next quantum to come 134 137 */ 135 138 cpu_sleep(); … … 220 223 CPU->needs_relink = 0; 221 224 } 222 spinlock_unlock(&CPU->lock); 225 spinlock_unlock(&CPU->lock); 223 226 224 227 } … … 463 466 * passes. Each time get the most up to date counts. 464 467 */ 465 average = atomic_get(&nrdy) / config.cpu_active ;468 average = atomic_get(&nrdy) / config.cpu_active + 1; 466 469 count = average - atomic_get(&CPU->nrdy); 467 470 468 if (count < 0)471 if (count <= 0) 469 472 goto satisfied; 470 471 if (!count) { /* Try to steal threads from CPU's that have more then average count */472 count = 1;473 average += 1;474 }475 473 476 474 /* … … 494 492 continue; 495 493 496 restart:ipl = interrupts_disable();494 ipl = interrupts_disable(); 497 495 r = &cpu->rq[j]; 498 496 spinlock_lock(&r->lock); … … 514 512 spinlock_lock(&t->lock); 515 513 if ( (!(t->flags & (X_WIRED | X_STOLEN))) && (!(t->fpu_context_engaged)) ) { 516 517 514 /* 518 515 * Remove t from r. 519 516 */ 520 521 517 spinlock_unlock(&t->lock); 522 518 523 /*524 * Here we have to avoid deadlock with relink_rq(),525 * because it locks cpu and r in a different order than we do.526 */527 if (!spinlock_trylock(&cpu->lock)) {528 /* Release all locks and try again. */529 spinlock_unlock(&r->lock);530 interrupts_restore(ipl);531 goto restart;532 }533 519 atomic_dec(&cpu->nrdy); 534 spinlock_unlock(&cpu->lock);535 536 520 atomic_dec(&nrdy); 537 521
Note:
See TracChangeset
for help on using the changeset viewer.