Prefer the proc lock to sched_lock when testing PS_INMEM now that it is

safe to do so.
This commit is contained in:
John Baldwin 2003-04-22 20:01:56 +00:00
parent 664f718ba1
commit eeec6bab2e
3 changed files with 13 additions and 21 deletions

View File

@ -222,31 +222,23 @@ struct linux_pt_fpxreg {
static int
linux_proc_read_fpxregs(struct thread *td, struct linux_pt_fpxreg *fpxregs)
{
int error;
error = 0;
mtx_lock_spin(&sched_lock);
PROC_LOCK_ASSERT(td->td_proc, MA_OWNED);
if (cpu_fxsr == 0 || (td->td_proc->p_sflag & PS_INMEM) == 0)
error = EIO;
else
bcopy(&td->td_pcb->pcb_save.sv_xmm, fpxregs, sizeof(*fpxregs));
mtx_unlock_spin(&sched_lock);
return (error);
return (EIO);
bcopy(&td->td_pcb->pcb_save.sv_xmm, fpxregs, sizeof(*fpxregs));
return (0);
}
static int
linux_proc_write_fpxregs(struct thread *td, struct linux_pt_fpxreg *fpxregs)
{
int error;
error = 0;
mtx_lock_spin(&sched_lock);
PROC_LOCK_ASSERT(td->td_proc, MA_OWNED);
if (cpu_fxsr == 0 || (td->td_proc->p_sflag & PS_INMEM) == 0)
error = EIO;
else
bcopy(fpxregs, &td->td_pcb->pcb_save.sv_xmm, sizeof(*fpxregs));
mtx_unlock_spin(&sched_lock);
return (error);
return (EIO);
bcopy(fpxregs, &td->td_pcb->pcb_save.sv_xmm, sizeof(*fpxregs));
return (0);
}
#endif

View File

@ -82,12 +82,11 @@
#define PROC_ACTION(action) do { \
int error; \
\
mtx_lock_spin(&sched_lock); \
PROC_LOCK_ASSERT(td->td_proc, MA_OWNED); \
if ((td->td_proc->p_sflag & PS_INMEM) == 0) \
error = EIO; \
else \
error = (action); \
mtx_unlock_spin(&sched_lock); \
return (error); \
} while(0)

View File

@ -917,15 +917,16 @@ RetryFault:;
}
vm_page_wakeup(fs.m);
vm_page_unlock_queues();
mtx_lock_spin(&sched_lock);
if (curproc && (curproc->p_sflag & PS_INMEM) && curproc->p_stats) {
PROC_LOCK(curproc);
if ((curproc->p_sflag & PS_INMEM) && curproc->p_stats) {
if (hardfault) {
curproc->p_stats->p_ru.ru_majflt++;
} else {
curproc->p_stats->p_ru.ru_minflt++;
}
}
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(curproc);
/*
* Unlock everything, and return