Changeset dfa4be62 in mainline for kernel/generic/src/proc/scheduler.c


Ignore:
Timestamp:
2024-01-21T16:23:19Z (18 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
d23712e
Parents:
a3d87b9
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-03-28 17:40:43)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-21 16:23:19)
Message:

Thread lock is no longer necessary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/scheduler.c

    ra3d87b9 rdfa4be62  
    310310        switch_task(THREAD->task);
    311311
    312         irq_spinlock_lock(&THREAD->lock, false);
    313312        assert(atomic_get_unordered(&THREAD->cpu) == CPU);
    314313
     
    364363        /* Save current CPU cycle */
    365364        THREAD->last_cycle = get_cycle();
    366 
    367         irq_spinlock_unlock(&THREAD->lock, false);
    368365}
    369366
     
    386383static void thread_requeue_preempted(thread_t *thread)
    387384{
    388         irq_spinlock_lock(&thread->lock, false);
    389 
    390385        assert(atomic_get_unordered(&thread->state) == Running);
    391386        assert(atomic_get_unordered(&thread->cpu) == CPU);
     
    400395        atomic_set_unordered(&thread->state, Ready);
    401396
    402         irq_spinlock_unlock(&thread->lock, false);
    403 
    404397        add_to_rq(thread, CPU, prio);
    405398}
     
    408401{
    409402        ipl_t ipl = interrupts_disable();
    410 
    411         irq_spinlock_lock(&thread->lock, false);
    412403
    413404        assert(atomic_get_unordered(&thread->state) == Sleeping || atomic_get_unordered(&thread->state) == Entering);
     
    423414                atomic_set_unordered(&thread->cpu, CPU);
    424415        }
    425 
    426         irq_spinlock_unlock(&thread->lock, false);
    427416
    428417        add_to_rq(thread, cpu, 0);
     
    500489        }
    501490
    502         irq_spinlock_lock(&THREAD->lock, false);
    503 
    504491        atomic_set_unordered(&THREAD->state, new_state);
    505492
     
    514501         */
    515502        after_thread_ran_arch();
    516 
    517         irq_spinlock_unlock(&THREAD->lock, false);
    518503
    519504        CPU_LOCAL->exiting_state = new_state;
     
    650635        list_foreach_rev(old_rq->rq, rq_link, thread_t, thread) {
    651636
    652                 irq_spinlock_lock(&thread->lock, false);
    653 
    654637                /*
    655638                 * Do not steal CPU-wired threads, threads
     
    658641                 * FPU context is still in the CPU.
    659642                 */
    660                 if (thread->stolen || thread->nomigrate ||
    661                     thread == fpu_owner) {
    662                         irq_spinlock_unlock(&thread->lock, false);
     643                if (thread->stolen || thread->nomigrate || thread == fpu_owner) {
    663644                        continue;
    664645                }
     
    666647                thread->stolen = true;
    667648                atomic_set_unordered(&thread->cpu, CPU);
    668 
    669                 irq_spinlock_unlock(&thread->lock, false);
    670649
    671650                /*
Note: See TracChangeset for help on using the changeset viewer.