Changeset c7326f21 in mainline for kernel/generic/src/proc/thread.c
- Timestamp:
- 2023-02-25T11:51:04Z (20 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4f84ee42
- Parents:
- 4777e02
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-22 12:09:47)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-25 11:51:04)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
r4777e02 rc7326f21 135 135 f(arg); 136 136 137 /* Accumulate accounting to the task */138 irq_spinlock_lock(&THREAD->lock, true);139 if (!THREAD->uncounted) {140 thread_update_accounting(true);141 uint64_t ucycles = THREAD->ucycles;142 THREAD->ucycles = 0;143 uint64_t kcycles = THREAD->kcycles;144 THREAD->kcycles = 0;145 146 irq_spinlock_pass(&THREAD->lock, &TASK->lock);147 TASK->ucycles += ucycles;148 TASK->kcycles += kcycles;149 irq_spinlock_unlock(&TASK->lock, true);150 } else151 irq_spinlock_unlock(&THREAD->lock, true);152 153 137 thread_exit(); 154 138 … … 419 403 ipl_t ipl = interrupts_disable(); 420 404 421 /* Remove thread from task's list. */422 irq_spinlock_lock(&thread->task->lock, false);423 list_remove(&thread->th_link);424 irq_spinlock_unlock(&thread->task->lock, false);425 426 405 /* Remove thread from global list. */ 427 406 irq_spinlock_lock(&threads_lock, false); … … 429 408 irq_spinlock_unlock(&threads_lock, false); 430 409 431 /* Clear cpu->fpu_owner if set to this thread. */ 432 irq_spinlock_lock(&thread->lock, false); 410 /* Remove thread from task's list and accumulate accounting. */ 411 irq_spinlock_lock(&thread->task->lock, false); 412 413 list_remove(&thread->th_link); 414 415 /* 416 * No other CPU has access to this thread anymore, so we don't need 417 * thread->lock for accessing thread's fields after this point. 418 */ 419 420 if (!thread->uncounted) { 421 thread->task->ucycles += thread->ucycles; 422 thread->task->kcycles += thread->kcycles; 423 } 424 425 irq_spinlock_unlock(&thread->task->lock, false); 433 426 434 427 assert((thread->state == Exiting) || (thread->state == Lingering)); 435 428 assert(thread->cpu); 436 429 430 /* Clear cpu->fpu_owner if set to this thread. */ 437 431 irq_spinlock_lock(&thread->cpu->lock, false); 438 432 if (thread->cpu->fpu_owner == thread) 439 433 thread->cpu->fpu_owner = NULL; 440 434 irq_spinlock_unlock(&thread->cpu->lock, false); 441 442 irq_spinlock_unlock(&thread->lock, false);443 435 444 436 interrupts_restore(ipl);
Note:
See TracChangeset
for help on using the changeset viewer.