Changeset 22f7769 in mainline for src/proc/scheduler.c
- Timestamp:
- 2005-10-17T23:31:41Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4b2c872d
- Parents:
- 75eacab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/proc/scheduler.c
r75eacab r22f7769 126 126 127 127 loop: 128 cpu_priority_high();128 interrupts_disable(); 129 129 130 130 spinlock_lock(&CPU->lock); … … 132 132 spinlock_unlock(&CPU->lock); 133 133 134 cpu_priority_low();134 interrupts_enable(); 135 135 136 136 if (n == 0) { … … 156 156 } 157 157 158 cpu_priority_high();158 interrupts_disable(); 159 159 160 160 i = 0; … … 197 197 198 198 t->ticks = us2ticks((i+1)*10000); 199 t->pri = i; /* eventually correct rq index */199 t->priority = i; /* eventually correct rq index */ 200 200 201 201 /* … … 262 262 void scheduler(void) 263 263 { 264 volatile pri_t pri;264 volatile ipl_t ipl; 265 265 266 266 ASSERT(CPU != NULL); 267 267 268 pri = cpu_priority_high();268 ipl = interrupts_disable(); 269 269 270 270 if (haltstate) … … 282 282 before_thread_runs(); 283 283 spinlock_unlock(&THREAD->lock); 284 cpu_priority_restore(THREAD->saved_context.pri);284 interrupts_restore(THREAD->saved_context.ipl); 285 285 return; 286 286 } 287 287 288 288 /* 289 * CPU priorityof preempted thread is recorded here290 * to facilitate scheduler() invocations from 291 * c pu_priority_high()'ed code (e.g. waitq_sleep_timeout()).292 */ 293 THREAD->saved_context. pri = pri;289 * Interrupt priority level of preempted thread is recorded here 290 * to facilitate scheduler() invocations from interrupts_disable()'d 291 * code (e.g. waitq_sleep_timeout()). 292 */ 293 THREAD->saved_context.ipl = ipl; 294 294 } 295 295 … … 372 372 * Prefer the thread after it's woken up. 373 373 */ 374 THREAD->pri = -1;374 THREAD->priority = -1; 375 375 376 376 /* … … 407 407 408 408 spinlock_lock(&THREAD->lock); 409 priority = THREAD->pri ;409 priority = THREAD->priority; 410 410 spinlock_unlock(&THREAD->lock); 411 411 … … 447 447 448 448 #ifdef SCHEDULER_VERBOSE 449 printf("cpu%d: tid %d (pri =%d,ticks=%d,nrdy=%d)\n", CPU->id, THREAD->tid, THREAD->pri, THREAD->ticks, CPU->nrdy);449 printf("cpu%d: tid %d (priority=%d,ticks=%d,nrdy=%d)\n", CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, CPU->nrdy); 450 450 #endif 451 451 … … 473 473 thread_t *t; 474 474 int count, i, j, k = 0; 475 pri_t pri;475 ipl_t ipl; 476 476 477 477 loop: … … 487 487 * passes. Each time get the most up to date counts. 488 488 */ 489 pri = cpu_priority_high();489 ipl = interrupts_disable(); 490 490 spinlock_lock(&CPU->lock); 491 491 count = nrdy / config.cpu_active; 492 492 count -= CPU->nrdy; 493 493 spinlock_unlock(&CPU->lock); 494 cpu_priority_restore(pri);494 interrupts_restore(ipl); 495 495 496 496 if (count <= 0) … … 515 515 continue; 516 516 517 restart: pri = cpu_priority_high();517 restart: ipl = interrupts_disable(); 518 518 r = &cpu->rq[j]; 519 519 spinlock_lock(&r->lock); 520 520 if (r->n == 0) { 521 521 spinlock_unlock(&r->lock); 522 cpu_priority_restore(pri);522 interrupts_restore(ipl); 523 523 continue; 524 524 } … … 549 549 /* Release all locks and try again. */ 550 550 spinlock_unlock(&r->lock); 551 cpu_priority_restore(pri);551 interrupts_restore(ipl); 552 552 goto restart; 553 553 } … … 581 581 thread_ready(t); 582 582 583 cpu_priority_restore(pri);583 interrupts_restore(ipl); 584 584 585 585 if (--count == 0) … … 593 593 continue; 594 594 } 595 cpu_priority_restore(pri);595 interrupts_restore(ipl); 596 596 } 597 597 }
Note:
See TracChangeset
for help on using the changeset viewer.