Process and lwp exit path always executes lwp_exit2() now and cpu_exit()

is empty besides calling switch_exit(). So, rename switch_exit() to
cpu_exit() and modify the routine to call lwp_exit2() direct.
This saves couple cycles on the exit path.
This commit is contained in:
jdolecek 2004-01-04 11:44:52 +00:00
parent 089abdad44
commit c3bb9cd5a4
3 changed files with 10 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.20 2003/11/04 10:33:15 dsl Exp $ */
/* $NetBSD: locore.S,v 1.21 2004/01/04 11:44:52 jdolecek Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -2028,7 +2028,7 @@ ENTRY(cpu_switchto)
jmp switch_resume
/*
* void switch_exit(struct lwp *l, void (*exit)(struct lwp *));
* void cpu_exit(struct lwp *l)
* Switch to the appropriate idle context (lwp0's if uniprocessor; the cpu's
* if multiprocessor) and deallocate the address space and kernel stack for p.
* Then jump into cpu_switch(), as if we were in the idle proc all along.
@ -2038,10 +2038,9 @@ ENTRY(cpu_switchto)
#endif
.globl _C_LABEL(uvmspace_free),_C_LABEL(kernel_map)
.globl _C_LABEL(uvm_km_free),_C_LABEL(tss_free)
/* LINTSTUB: Func: void switch_exit(struct lwp *l, void (*exit)(struct lwp *)) */
ENTRY(switch_exit)
/* LINTSTUB: Func: void cpu_exit(struct lwp *l) */
ENTRY(cpu_exit)
movl 4(%esp),%edi # old process
movl 8(%esp),%eax # exit func
#ifndef MULTIPROCESSOR
movl $_C_LABEL(lwp0),%ebx
movl L_ADDR(%ebx),%esi
@ -2060,9 +2059,6 @@ ENTRY(switch_exit)
movl PCB_ESP(%esi),%esp
movl PCB_EBP(%esi),%ebp
/* Save exit func. */
pushl %eax
/* Load TSS info. */
#ifdef MULTIPROCESSOR
movl CPUVAR(GDT),%eax
@ -2092,11 +2088,10 @@ ENTRY(switch_exit)
sti
/*
* Schedule the dead process's vmspace and stack to be freed.
* Schedule the dead LWP's stack to be freed.
*/
movl 0(%esp),%eax /* %eax = exit func */
movl %edi,0(%esp) /* {lwp_}exit2(l) */
call *%eax
pushl %edi
call _C_LABEL(lwp_exit2)
addl $4,%esp
/* Jump into cpu_switch() with the right state. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.113 2004/01/04 11:33:30 jdolecek Exp $ */
/* $NetBSD: vm_machdep.c,v 1.114 2004/01/04 11:44:52 jdolecek Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.113 2004/01/04 11:33:30 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.114 2004/01/04 11:44:52 jdolecek Exp $");
#include "opt_user_ldt.h"
#include "opt_largepages.h"
@ -248,14 +248,6 @@ cpu_swapout(l)
#endif
}
void
cpu_exit(struct lwp *l)
{
switch_exit(l, lwp_exit2);
/* NOTREACHED */
}
/*
* cpu_lwp_free is called from exit() to let machine-dependent
* code free machine-dependent resources that should be cleaned

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.111 2003/12/30 12:33:22 pk Exp $ */
/* $NetBSD: cpu.h,v 1.112 2004/01/04 11:44:52 jdolecek Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -367,7 +367,6 @@ void fillw(short, void *, size_t);
struct pcb;
void savectx(struct pcb *);
void switch_exit(struct lwp *, void (*)(struct lwp *));
void proc_trampoline(void);
/* clock.c */