Changeset c680333 in mainline
- Timestamp:
- 2023-04-07T18:23:19Z (21 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2a230b6, dd218ea
- Parents:
- 3118355
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-03-04 18:17:37)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-04-07 18:23:19)
- Location:
- kernel/generic/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/as.c
r3118355 rc680333 1688 1688 spinlock_unlock(&asidlock); 1689 1689 1690 if (AS) 1691 as_release(AS); 1692 1690 1693 AS = new_as; 1694 1695 as_hold(AS); 1691 1696 } 1692 1697 -
kernel/generic/src/proc/scheduler.c
r3118355 rc680333 70 70 atomic_size_t nrdy; /**< Number of ready threads in the system. */ 71 71 72 /** Carry out actions before new task runs. */73 static void before_task_runs(void)74 {75 before_task_runs_arch();76 }77 78 72 /** Take actions before new thread runs. 79 73 * … … 255 249 256 250 goto loop; 251 } 252 253 static void switch_task(task_t *task) 254 { 255 /* If the task stays the same, a lot of work is avoided. */ 256 if (TASK == task) 257 return; 258 259 as_t *old_as = AS; 260 as_t *new_as = task->as; 261 262 /* It is possible for two tasks to share one address space. */ 263 if (old_as != new_as) 264 as_switch(old_as, new_as); 265 266 if (TASK) 267 task_release(TASK); 268 269 TASK = task; 270 271 task_hold(TASK); 272 273 before_task_runs_arch(); 257 274 } 258 275 … … 403 420 void scheduler_separated_stack(void) 404 421 { 405 task_t *old_task = TASK;406 as_t *old_as = AS;407 408 422 assert((!THREAD) || (irq_spinlock_locked(&THREAD->lock))); 409 423 assert(CPU != NULL); 410 424 assert(interrupts_disabled()); 411 412 /*413 * Hold the current task and the address space to prevent their414 * possible destruction should thread_destroy() be called on this or any415 * other processor while the scheduler is still using them.416 */417 if (old_task)418 task_hold(old_task);419 420 if (old_as)421 as_hold(old_as);422 425 423 426 if (THREAD) { … … 471 474 relink_rq(priority); 472 475 473 /* 474 * If both the old and the new task are the same, 475 * lots of work is avoided. 476 */ 477 if (TASK != THREAD->task) { 478 as_t *new_as = THREAD->task->as; 479 480 /* 481 * Note that it is possible for two tasks 482 * to share one address space. 483 */ 484 if (old_as != new_as) { 485 /* 486 * Both tasks and address spaces are different. 487 * Replace the old one with the new one. 488 */ 489 as_switch(old_as, new_as); 490 } 491 492 TASK = THREAD->task; 493 before_task_runs(); 494 } 495 496 if (old_task) 497 task_release(old_task); 498 499 if (old_as) 500 as_release(old_as); 476 switch_task(THREAD->task); 501 477 502 478 irq_spinlock_lock(&THREAD->lock, false);
Note:
See TracChangeset
for help on using the changeset viewer.