mirror of
https://github.com/opnsense/src.git
synced 2026-05-04 17:05:14 -04:00
Make the schedlock saved critical section state a per-thread property.
This commit is contained in:
parent
5916bd20ba
commit
a300519d41
2 changed files with 3 additions and 4 deletions
|
|
@ -344,7 +344,6 @@ ithread_schedule(struct ithd *ithread, int do_switch)
|
|||
{
|
||||
struct int_entropy entropy;
|
||||
struct proc *p;
|
||||
critical_t savecrit;
|
||||
|
||||
/*
|
||||
* If no ithread or no handlers, then we have a stray interrupt.
|
||||
|
|
@ -383,13 +382,10 @@ ithread_schedule(struct ithd *ithread, int do_switch)
|
|||
p->p_stat = SRUN;
|
||||
setrunqueue(p);
|
||||
if (do_switch && curproc->p_stat == SRUN) {
|
||||
savecrit = sched_lock.mtx_savecrit;
|
||||
mtx_intr_enable(&sched_lock);
|
||||
if (curproc != PCPU_GET(idleproc))
|
||||
setrunqueue(curproc);
|
||||
curproc->p_stats->p_ru.ru_nivcsw++;
|
||||
mi_switch();
|
||||
sched_lock.mtx_savecrit = savecrit;
|
||||
} else
|
||||
need_resched(curproc);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -821,6 +821,7 @@ mi_switch()
|
|||
#if 0
|
||||
register struct rlimit *rlim;
|
||||
#endif
|
||||
critical_t sched_crit;
|
||||
u_int sched_nest;
|
||||
|
||||
mtx_assert(&sched_lock, MA_OWNED | MA_NOTRECURSED);
|
||||
|
|
@ -881,12 +882,14 @@ mi_switch()
|
|||
PCPU_SET(switchtime, new_switchtime);
|
||||
CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d, %s)", p, p->p_pid,
|
||||
p->p_comm);
|
||||
sched_crit = sched_lock.mtx_savecrit;
|
||||
sched_nest = sched_lock.mtx_recurse;
|
||||
curproc->p_lastcpu = curproc->p_oncpu;
|
||||
curproc->p_oncpu = NOCPU;
|
||||
clear_resched(curproc);
|
||||
cpu_switch();
|
||||
curproc->p_oncpu = PCPU_GET(cpuid);
|
||||
sched_lock.mtx_savecrit = sched_crit;
|
||||
sched_lock.mtx_recurse = sched_nest;
|
||||
sched_lock.mtx_lock = (uintptr_t)curproc;
|
||||
CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d, %s)", p, p->p_pid,
|
||||
|
|
|
|||
Loading…
Reference in a new issue