amd64: avoid acquiring dt lock if possible (which is the common case)
Discussed with: kib MFC after: 1 week
This commit is contained in:
parent
95ce4c00ec
commit
d95498d44f
@ -581,12 +581,9 @@ exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
|
||||
struct trapframe *regs = td->td_frame;
|
||||
struct pcb *pcb = td->td_pcb;
|
||||
|
||||
mtx_lock(&dt_lock);
|
||||
if (td->td_proc->p_md.md_ldt != NULL)
|
||||
user_ldt_free(td);
|
||||
else
|
||||
mtx_unlock(&dt_lock);
|
||||
|
||||
|
||||
update_pcb_bases(pcb);
|
||||
pcb->pcb_fsbase = 0;
|
||||
pcb->pcb_gsbase = 0;
|
||||
|
@ -500,7 +500,7 @@ user_ldt_free(struct thread *td)
|
||||
struct mdproc *mdp = &p->p_md;
|
||||
struct proc_ldt *pldt;
|
||||
|
||||
mtx_assert(&dt_lock, MA_OWNED);
|
||||
mtx_lock(&dt_lock);
|
||||
if ((pldt = mdp->md_ldt) == NULL) {
|
||||
mtx_unlock(&dt_lock);
|
||||
return;
|
||||
|
@ -299,11 +299,8 @@ cpu_exit(struct thread *td)
|
||||
/*
|
||||
* If this process has a custom LDT, release it.
|
||||
*/
|
||||
mtx_lock(&dt_lock);
|
||||
if (td->td_proc->p_md.md_ldt != 0)
|
||||
if (td->td_proc->p_md.md_ldt != NULL)
|
||||
user_ldt_free(td);
|
||||
else
|
||||
mtx_unlock(&dt_lock);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -937,12 +937,9 @@ ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack)
|
||||
{
|
||||
struct trapframe *regs = td->td_frame;
|
||||
struct pcb *pcb = td->td_pcb;
|
||||
|
||||
mtx_lock(&dt_lock);
|
||||
|
||||
if (td->td_proc->p_md.md_ldt != NULL)
|
||||
user_ldt_free(td);
|
||||
else
|
||||
mtx_unlock(&dt_lock);
|
||||
#ifdef COMPAT_43
|
||||
setup_lcall_gate();
|
||||
#endif
|
||||
|
@ -453,11 +453,8 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
|
||||
struct trapframe *regs = td->td_frame;
|
||||
struct pcb *pcb = td->td_pcb;
|
||||
|
||||
mtx_lock(&dt_lock);
|
||||
if (td->td_proc->p_md.md_ldt != NULL)
|
||||
user_ldt_free(td);
|
||||
else
|
||||
mtx_unlock(&dt_lock);
|
||||
|
||||
pcb->pcb_fsbase = 0;
|
||||
pcb->pcb_gsbase = 0;
|
||||
|
@ -804,11 +804,8 @@ exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack)
|
||||
struct trapframe *regs = td->td_frame;
|
||||
struct pcb *pcb = td->td_pcb;
|
||||
|
||||
mtx_lock(&dt_lock);
|
||||
if (td->td_proc->p_md.md_ldt != NULL)
|
||||
user_ldt_free(td);
|
||||
else
|
||||
mtx_unlock(&dt_lock);
|
||||
|
||||
critical_enter();
|
||||
wrmsr(MSR_FSBASE, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user