Changeset 3d84734 in mainline
- Timestamp:
- 2024-01-20T17:19:52Z (13 months ago)
- Branches:
- master
- Children:
- 41bfc64
- Parents:
- efed95a3
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-20 17:18:35)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-20 17:19:52)
- Location:
- kernel/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/thread.h
refed95a3 r3d84734 155 155 156 156 /** Thread's priority. Implemented as index to CPU->rq */ 157 int priority;157 atomic_int_fast32_t priority; 158 158 /** Thread ID. */ 159 159 thread_id_t tid; -
kernel/generic/src/proc/scheduler.c
refed95a3 r3d84734 314 314 315 315 THREAD->state = Running; 316 THREAD->priority = rq_index; /* Correct rq index */316 atomic_set_unordered(&THREAD->priority, rq_index); /* Correct rq index */ 317 317 318 318 /* … … 325 325 log(LF_OTHER, LVL_DEBUG, 326 326 "cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64 327 ", nrdy=%zu)", CPU->id, THREAD->tid, THREAD->priority,327 ", nrdy=%zu)", CPU->id, THREAD->tid, rq_index, 328 328 THREAD->ticks, atomic_load(&CPU->nrdy)); 329 329 #endif … … 389 389 assert(atomic_get_unordered(&thread->cpu) == CPU); 390 390 391 int i = (thread->priority < RQ_COUNT - 1) ? 392 ++thread->priority : thread->priority; 391 int prio = atomic_get_unordered(&thread->priority); 392 393 if (prio < RQ_COUNT - 1) { 394 prio++; 395 atomic_set_unordered(&thread->priority, prio); 396 } 393 397 394 398 thread->state = Ready; … … 396 400 irq_spinlock_unlock(&thread->lock, false); 397 401 398 add_to_rq(thread, CPU, i);402 add_to_rq(thread, CPU, prio); 399 403 } 400 404 … … 407 411 assert(thread->state == Sleeping || thread->state == Entering); 408 412 409 thread->priority = 0;413 atomic_set_unordered(&thread->priority, 0); 410 414 thread->state = Ready; 411 415 -
kernel/generic/src/proc/thread.c
refed95a3 r3d84734 262 262 thread->uncounted = 263 263 ((flags & THREAD_FLAG_UNCOUNTED) == THREAD_FLAG_UNCOUNTED); 264 thread->priority = -1; /* Start in rq[0] */264 atomic_init(&thread->priority, -1); /* Start in rq[0] */ 265 265 atomic_init(&thread->cpu, NULL); 266 266 thread->stolen = false; -
kernel/generic/src/sysinfo/stats.c
refed95a3 r3d84734 304 304 stats_thread->task_id = thread->task->taskid; 305 305 stats_thread->state = thread->state; 306 stats_thread->priority = thread->priority;306 stats_thread->priority = atomic_get_unordered(&thread->priority); 307 307 stats_thread->ucycles = thread->ucycles; 308 308 stats_thread->kcycles = thread->kcycles;
Note:
See TracChangeset
for help on using the changeset viewer.