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


Ignore:
Timestamp:
2023-04-16T12:22:00Z (8 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade
Children:
fbaf6ac
Parents:
b2ec5cf
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-04-16 12:14:09)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-04-16 12:22:00)
Message:

Split cpu_t::lock into fpu_lock and tlb_lock

For all other purposes, locking is unnecessary, since the fields
in question are only accessed locally from the CPU they belong to.

File:
1 edited

Legend:

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

    rb2ec5cf r169815e  
    129129{
    130130        fpu_enable();
    131         irq_spinlock_lock(&CPU->lock, false);
     131        irq_spinlock_lock(&CPU->fpu_lock, false);
    132132
    133133        /* Save old context */
     
    154154        irq_spinlock_unlock(&THREAD->lock, false);
    155155
    156         irq_spinlock_unlock(&CPU->lock, false);
     156        irq_spinlock_unlock(&CPU->fpu_lock, false);
    157157}
    158158#endif /* CONFIG_FPU_LAZY */
     
    187187                 * This improves energy saving and hyperthreading.
    188188                 */
    189                 irq_spinlock_lock(&CPU->lock, false);
    190189                CPU->idle = true;
    191                 irq_spinlock_unlock(&CPU->lock, false);
    192190
    193191                /*
     
    298296        size_t n = 0;
    299297
    300         irq_spinlock_lock(&CPU->lock, false);
    301 
    302298        /* Move every list (except the one with highest priority) one level up. */
    303299        for (int i = RQ_COUNT - 1; i > start; i--) {
     
    322318                irq_spinlock_unlock(&CPU->rq[start].lock, false);
    323319        }
    324 
    325         irq_spinlock_unlock(&CPU->lock, false);
    326320}
    327321
     
    684678                        continue;
    685679
    686                 irq_spinlock_lock(&cpus[cpu].lock, true);
    687 
    688680                /* Technically a data race, but we don't really care in this case. */
    689681                int needs_relink = cpus[cpu].relink_deadline - cpus[cpu].current_clock_tick;
     
    711703                        irq_spinlock_unlock(&(cpus[cpu].rq[i].lock), false);
    712704                }
    713 
    714                 irq_spinlock_unlock(&cpus[cpu].lock, true);
    715705        }
    716706}
Note: See TracChangeset for help on using the changeset viewer.