Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Remove uarea swap-out functionality:
details: https://anonhg.NetBSD.org/src/rev/75ae9b7fa5c3
branches: trunk
changeset: 748354:75ae9b7fa5c3
user: rmind <rmind%NetBSD.org@localhost>
date: Wed Oct 21 21:11:57 2009 +0000
description:
Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.
Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).
Discussed on <tech-kern>, reviewed by <ad>.
diffstat:
bin/ps/keyword.c | 6 +-
bin/ps/print.c | 31 +-
bin/ps/ps.1 | 14 +-
external/bsd/top/dist/machine/m_netbsd.c | 16 +-
lib/libkvm/kvm_proc.c | 6 +-
share/man/man9/uvm.9 | 16 +-
sys/arch/acorn26/acorn26/pmap.c | 13 +-
sys/arch/acorn26/acorn26/vm_machdep.c | 18 +-
sys/arch/alpha/alpha/db_trace.c | 8 +-
sys/arch/alpha/alpha/pmap.c | 43 +--
sys/arch/alpha/alpha/vm_machdep.c | 33 +-
sys/arch/amd64/amd64/db_trace.c | 8 +-
sys/arch/amiga/amiga/pmap.c | 12 +-
sys/arch/amiga/include/cpu.h | 4 +-
sys/arch/arc/TODO | 4 +-
sys/arch/arm/arm/db_trace.c | 8 +-
sys/arch/arm/arm/syscall.c | 5 +-
sys/arch/arm/arm32/pmap.c | 23 +-
sys/arch/arm/arm32/vm_machdep.c | 57 +---
sys/arch/atari/atari/pmap.c | 12 +-
sys/arch/atari/include/cpu.h | 4 +-
sys/arch/cesfic/include/cpu.h | 4 +-
sys/arch/evbmips/conf/std.gdium | 3 +-
sys/arch/hp300/include/cpu.h | 4 +-
sys/arch/hppa/hppa/db_trace.c | 8 +-
sys/arch/hppa/hppa/pmap.c | 13 +-
sys/arch/hppa/hppa/vm_machdep.c | 25 +-
sys/arch/i386/i386/db_trace.c | 8 +-
sys/arch/i386/i386/process_machdep.c | 8 +-
sys/arch/ia64/ia64/pmap.c | 42 +--
sys/arch/ia64/ia64/vm_machdep.c | 29 +-
sys/arch/luna68k/include/cpu.h | 4 +-
sys/arch/m68k/m68k/db_trace.c | 8 +-
sys/arch/m68k/m68k/pmap_motorola.c | 14 +-
sys/arch/mac68k/include/cpu.h | 4 +-
sys/arch/mips/include/cpu.h | 3 +-
sys/arch/mips/include/types.h | 4 +-
sys/arch/mips/mips/db_trace.c | 9 +-
sys/arch/mips/mips/mipsX_subr.S | 6 +-
sys/arch/mips/mips/pmap.c | 25 +-
sys/arch/mips/mips/vm_machdep.c | 30 +-
sys/arch/mvme68k/include/cpu.h | 4 +-
sys/arch/news68k/include/cpu.h | 4 +-
sys/arch/next68k/include/cpu.h | 4 +-
sys/arch/powerpc/ibm4xx/pmap.c | 17 +-
sys/arch/powerpc/ibm4xx/trap.c | 10 +-
sys/arch/powerpc/include/cpu.h | 4 +-
sys/arch/powerpc/include/oea/pmap.h | 4 +-
sys/arch/powerpc/oea/pmap.c | 21 +-
sys/arch/powerpc/powerpc/db_trace.c | 8 +-
sys/arch/powerpc/powerpc/process_machdep.c | 8 +-
sys/arch/sh3/include/cpu.h | 9 +-
sys/arch/sh3/include/pmap.h | 3 +-
sys/arch/sh3/include/types.h | 4 +-
sys/arch/sh3/sh3/process_machdep.c | 8 +-
sys/arch/sparc/include/cpu.h | 4 +-
sys/arch/sparc/include/pmap.h | 3 +-
sys/arch/sparc/sparc/db_trace.c | 8 +-
sys/arch/sparc/sparc/pmap.c | 18 +-
sys/arch/sparc64/conf/NONPLUS64 | 5 +-
sys/arch/sparc64/include/cpu.h | 4 +-
sys/arch/sparc64/sparc64/db_trace.c | 10 +-
sys/arch/sparc64/sparc64/machdep.c | 6 +-
sys/arch/sparc64/sparc64/pmap.c | 73 +----
sys/arch/sun2/sun2/pmap.c | 20 +-
sys/arch/sun3/sun3/pmap.c | 20 +-
sys/arch/sun3/sun3x/pmap.c | 17 +-
sys/arch/sun68k/include/cpu.h | 4 +-
sys/arch/usermode/include/cpu.h | 5 +-
sys/arch/usermode/usermode/pmap.c | 9 +-
sys/arch/vax/include/pmap.h | 3 +-
sys/arch/vax/vax/machdep.c | 10 +-
sys/arch/vax/vax/pmap.c | 68 +--
sys/arch/x68k/include/cpu.h | 4 +-
sys/arch/x86/x86/pmap.c | 32 +-
sys/arch/x86/x86/syscall.c | 5 +-
sys/arch/x86/x86/vm_machdep.c | 23 +-
sys/compat/linux/arch/i386/linux_ptrace.c | 10 +-
sys/compat/linux/arch/powerpc/linux_ptrace.c | 10 +-
sys/compat/mach/mach_thread.c | 15 +-
sys/compat/sa/compat_sa.c | 63 +--
sys/conf/std | 3 +-
sys/dev/i2o/iop.c | 16 +-
sys/dev/ic/dpt.c | 6 +-
sys/dev/ic/rrunner.c | 11 +-
sys/dev/scsipi/cd.c | 102 ++---
sys/dev/scsipi/ch.c | 13 +-
sys/dev/scsipi/if_se.c | 8 +-
sys/dev/scsipi/scsiconf.c | 7 +-
sys/dev/scsipi/scsipi_base.c | 20 +-
sys/dev/scsipi/scsipiconf.h | 3 +-
sys/dev/scsipi/sd.c | 16 +-
sys/dev/scsipi/ss_mustek.c | 10 +-
sys/dev/scsipi/ss_scanjet.c | 8 +-
sys/dev/scsipi/st.c | 9 +-
sys/dev/scsipi/st_atapi.c | 11 +-
sys/dev/scsipi/st_scsi.c | 14 +-
sys/dev/usb/umass_scsipi.c | 7 +-
sys/kern/core_elf32.c | 8 +-
sys/kern/init_sysctl.c | 7 +-
sys/kern/kern_condvar.c | 31 +-
sys/kern/kern_fork.c | 24 +-
sys/kern/kern_kthread.c | 15 +-
sys/kern/kern_lwp.c | 36 +-
sys/kern/kern_proc.c | 10 +-
sys/kern/kern_runq.c | 8 +-
sys/kern/kern_sleepq.c | 42 +-
sys/kern/kern_synch.c | 36 +-
sys/kern/kern_turnstile.c | 8 +-
sys/kern/subr_percpu.c | 6 +-
sys/kern/subr_workqueue.c | 6 +-
sys/kern/sys_aio.c | 11 +-
sys/kern/sys_lwp.c | 31 +-
sys/kern/sys_process.c | 31 +-
sys/kern/sys_select.c | 11 +-
sys/miscfs/genfs/genfs_io.c | 6 +-
sys/miscfs/procfs/procfs_ctl.c | 6 +-
sys/miscfs/procfs/procfs_status.c | 13 +-
sys/nfs/nfs_syscalls.c | 7 +-
sys/nfs/nfs_vnops.c | 10 +-
sys/rump/librump/rumpkern/vm.c | 19 +-
sys/sys/lwp.h | 10 +-
sys/sys/sleepq.h | 8 +-
sys/sys/syncobj.h | 4 +-
sys/sys/vmmeter.h | 4 +-
sys/uvm/files.uvm | 4 +-
sys/uvm/uvm.h | 9 +-
sys/uvm/uvm_amap.c | 7 +-
sys/uvm/uvm_aobj.c | 6 +-
sys/uvm/uvm_extern.h | 32 +-
sys/uvm/uvm_glue.c | 471 +--------------------------
sys/uvm/uvm_init.c | 5 +-
sys/uvm/uvm_meter.c | 28 +-
sys/uvm/uvm_pdaemon.c | 19 +-
sys/uvm/uvm_pmap.h | 5 +-
sys/uvm/uvm_stat.c | 7 +-
sys/uvm/uvm_swap.c | 30 +-
usr.bin/systat/pigs.c | 9 +-
usr.bin/systat/ps.c | 12 +-
usr.bin/systat/systat.1 | 10 +-
usr.bin/systat/vmstat.c | 9 +-
usr.bin/vmstat/vmstat.1 | 8 +-
usr.bin/vmstat/vmstat.c | 17 +-
143 files changed, 528 insertions(+), 1981 deletions(-)
diffs (truncated from 7071 to 300 lines):
diff -r 7fe28d977b1a -r 75ae9b7fa5c3 bin/ps/keyword.c
--- a/bin/ps/keyword.c Wed Oct 21 19:30:46 2009 +0000
+++ b/bin/ps/keyword.c Wed Oct 21 21:11:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: keyword.c,v 1.52 2008/02/10 17:47:59 christos Exp $ */
+/* $NetBSD: keyword.c,v 1.53 2009/10/21 21:11:57 rmind Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: keyword.c,v 1.52 2008/02/10 17:47:59 christos Exp $");
+__RCSID("$NetBSD: keyword.c,v 1.53 2009/10/21 21:11:57 rmind Exp $");
#endif
#endif /* not lint */
@@ -133,6 +133,7 @@
VAR4("group", "GROUP", LJUST, gname),
VAR4("groupnames", "GROUPNAMES", LJUST, groupnames),
VAR4("groups", "GROUPS", LJUST, groups),
+ /* holdcnt: unused, left for compat. */
LVAR("holdcnt", "HOLDCNT", 0, l_holdcnt, INT, "d"),
VAR3("ignored", "sigignore", ALIAS),
PUVAR("inblk", "INBLK", 0, p_uru_inblock, UINT64, PRIu64),
@@ -158,6 +159,7 @@
PVAR("nlwp", "NLWP", 0, p_nlwps, UINT64, PRId64),
VAR3("nsignals", "nsigs", ALIAS),
PUVAR("nsigs", "NSIGS", 0, p_uru_nsignals, UINT64, PRIu64),
+ /* nswap: unused, left for compat. */
PUVAR("nswap", "NSWAP", 0, p_uru_nswap, UINT64, PRIu64),
PUVAR("nvcsw", "NVCSW", 0, p_uru_nvcsw, UINT64, PRIu64),
/*XXX*/ LVAR("nwchan", "WCHAN", 0, l_wchan, KPTR, PRIx64),
diff -r 7fe28d977b1a -r 75ae9b7fa5c3 bin/ps/print.c
--- a/bin/ps/print.c Wed Oct 21 19:30:46 2009 +0000
+++ b/bin/ps/print.c Wed Oct 21 21:11:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.111 2009/03/29 01:02:49 mrg Exp $ */
+/* $NetBSD: print.c,v 1.112 2009/10/21 21:11:57 rmind Exp $ */
/*
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-__RCSID("$NetBSD: print.c,v 1.111 2009/03/29 01:02:49 mrg Exp $");
+__RCSID("$NetBSD: print.c,v 1.112 2009/10/21 21:11:57 rmind Exp $");
#endif
#endif /* not lint */
@@ -483,6 +483,16 @@
flag = k->p_flag;
cp = buf;
+ /*
+ * NOTE: There are historical letters, which are no longer used:
+ *
+ * - W: indicated that process is swapped out.
+ * - L: indicated non-zero l_holdcnt (i.e. that process was
+ * prevented from swapping-out.
+ *
+ * These letters should not be used for new states to avoid
+ * conflicts with old applications which might depend on them.
+ */
switch (k->p_stat) {
case LSSTOP:
@@ -518,9 +528,6 @@
*cp = '?';
}
cp++;
- if (flag & L_INMEM) {
- } else
- *cp++ = 'W';
if (k->p_nice < NZERO)
*cp++ = '<';
else if (k->p_nice > NZERO)
@@ -533,9 +540,6 @@
*cp++ = 'V';
if (flag & P_SYSTEM)
*cp++ = 'K';
- /* system process might have this too, don't need to double up */
- else if (k->p_holdcnt)
- *cp++ = 'L';
if (k->p_eflag & EPROC_SLEADER)
*cp++ = 's';
if (flag & P_SA)
@@ -596,11 +600,6 @@
*cp = '?';
}
cp++;
- if (flag & L_INMEM) {
- } else
- *cp++ = 'W';
- if (k->l_holdcnt)
- *cp++ = 'L';
if (flag & L_DETACHED)
*cp++ = '-';
*cp = '\0';
@@ -1110,9 +1109,7 @@
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
- /* XXX - I don't like this */
- if (k->p_swtime == 0 || (k->p_flag & L_INMEM) == 0 ||
- k->p_realstat == SZOMB)
+ if (k->p_swtime == 0 || k->p_realstat == SZOMB)
return (0.0);
if (rawcpu)
return (100.0 * fxtofl(k->p_pctcpu));
@@ -1144,8 +1141,6 @@
if (failure)
return (0.0);
- if ((k->p_flag & L_INMEM) == 0)
- return (0.0);
/* XXX want pmap ptpages, segtab, etc. (per architecture) */
szptudot = uspace/getpagesize();
/* XXX don't have info about shared */
diff -r 7fe28d977b1a -r 75ae9b7fa5c3 bin/ps/ps.1
--- a/bin/ps/ps.1 Wed Oct 21 19:30:46 2009 +0000
+++ b/bin/ps/ps.1 Wed Oct 21 21:11:57 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ps.1,v 1.89 2009/08/03 22:22:10 wiz Exp $
+.\" $NetBSD: ps.1,v 1.90 2009/10/21 21:11:57 rmind Exp $
.\"
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -288,7 +288,6 @@
.Bl -column P_NOCLDSTOP P_NOCLDSTOP compact
.It Dv "P_ADVLOCK" Ta No "0x00000001 process may hold a POSIX advisory lock"
.It Dv "P_CONTROLT" Ta No "0x00000002 process has a controlling terminal"
-.It Dv "P_INMEM" Ta No "0x00000004 process is loaded into memory"
.It Dv "P_NOCLDSTOP" Ta No "0x00000008 no
.Dv SIGCHLD
when children stop
@@ -297,7 +296,7 @@
.It Dv "P_SELECT" Ta No "0x00000040 selecting; wakeup/waiting danger"
.It Dv "P_SINTR" Ta No "0x00000080 sleep is interruptible"
.It Dv "P_SUGID" Ta No "0x00000100 process had set id privileges since last exec"
-.It Dv "P_SYSTEM" Ta No "0x00000200 system process: no sigs, stats or swapping"
+.It Dv "P_SYSTEM" Ta No "0x00000200 system process: no sigs or stats"
.It Dv "P_TIMEOUT" Ta No "0x00000400 timing out during sleep"
.It Dv "P_TRACED" Ta No "0x00000800 process is being traced"
.It Dv "P_WAITED" Ta No "0x00001000 debugging process has waited for child"
@@ -382,9 +381,6 @@
The process is trying to exit.
.It K
The process is a kernel thread or system process.
-.It L
-The process has pages locked in core (for example, for raw
-.Tn I/O ) .
.It l
The process has multiple LWPs.
.It N
@@ -397,8 +393,6 @@
.It V
The process is suspended during a
.Xr vfork 2 .
-.It W
-The process is swapped out.
.It X
The process is being traced or debugged.
.El
@@ -522,8 +516,6 @@
group names (from group access list)
.It Ar groups
group access list
-.It Ar holdcnt
-number of holds on the process (if non-zero, process can't be swapped)
.It Ar inblk
total blocks read (alias
.Ar inblock )
@@ -568,8 +560,6 @@
.It Ar nsigs
total signals taken (alias
.Ar nsignals )
-.It Ar nswap
-total swaps in/out
.It Ar nvcsw
total voluntary context switches
.It Ar nwchan
diff -r 7fe28d977b1a -r 75ae9b7fa5c3 external/bsd/top/dist/machine/m_netbsd.c
--- a/external/bsd/top/dist/machine/m_netbsd.c Wed Oct 21 19:30:46 2009 +0000
+++ b/external/bsd/top/dist/machine/m_netbsd.c Wed Oct 21 21:11:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: m_netbsd.c,v 1.10 2009/07/27 16:26:48 njoly Exp $ */
+/* $NetBSD: m_netbsd.c,v 1.11 2009/10/21 21:11:57 rmind Exp $ */
/*
* top - a top users display for Unix
@@ -37,12 +37,12 @@
* Andrew Doran <ad%NetBSD.org@localhost>
*
*
- * $Id: m_netbsd.c,v 1.10 2009/07/27 16:26:48 njoly Exp $
+ * $Id: m_netbsd.c,v 1.11 2009/10/21 21:11:57 rmind Exp $
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.10 2009/07/27 16:26:48 njoly Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.11 2009/10/21 21:11:57 rmind Exp $");
#endif
#include <sys/param.h>
@@ -786,9 +786,7 @@
hp->remaining--;
/* get the process's user struct and set cputime */
- if ((pp->p_flag & L_INMEM) == 0)
- pretty = "<>";
- else if ((pp->p_flag & P_SYSTEM) != 0)
+ if ((pp->p_flag & P_SYSTEM) != 0)
pretty = "[]";
if (pretty[0] != '\0') {
@@ -888,12 +886,6 @@
/* get the process's user struct and set cputime */
if (pp) {
comm = pp->p_comm;
-#if 0
- /* XXX needs to be per thread but is not. just ignore for now. */
- if ((pp->p_flag & L_INMEM) == 0)
- pretty = "<>";
- else
-#endif
if ((pp->p_flag & P_SYSTEM) != 0)
pretty = "[]";
diff -r 7fe28d977b1a -r 75ae9b7fa5c3 lib/libkvm/kvm_proc.c
--- a/lib/libkvm/kvm_proc.c Wed Oct 21 19:30:46 2009 +0000
+++ b/lib/libkvm/kvm_proc.c Wed Oct 21 21:11:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_proc.c,v 1.83 2009/05/16 11:56:47 yamt Exp $ */
+/* $NetBSD: kvm_proc.c,v 1.84 2009/10/21 21:11:58 rmind Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
#else
-__RCSID("$NetBSD: kvm_proc.c,v 1.83 2009/05/16 11:56:47 yamt Exp $");
+__RCSID("$NetBSD: kvm_proc.c,v 1.84 2009/10/21 21:11:58 rmind Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -834,7 +834,7 @@
kl->l_swtime = l.l_swtime;
kl->l_slptime = l.l_slptime;
kl->l_schedflags = 0; /* XXX */
- kl->l_holdcnt = l.l_holdcnt;
+ kl->l_holdcnt = 0;
kl->l_priority = l.l_priority;
kl->l_usrpri = l.l_priority;
kl->l_stat = l.l_stat;
diff -r 7fe28d977b1a -r 75ae9b7fa5c3 share/man/man9/uvm.9
--- a/share/man/man9/uvm.9 Wed Oct 21 19:30:46 2009 +0000
+++ b/share/man/man9/uvm.9 Wed Oct 21 21:11:57 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: uvm.9,v 1.98 2009/08/03 19:08:48 rmind Exp $
+.\" $NetBSD: uvm.9,v 1.99 2009/10/21 21:11:58 rmind Exp $
.\"
.\" Copyright (c) 1998 Matthew R. Green
.\" All rights reserved.
@@ -677,8 +677,6 @@
.Fn uvm_pageout "void" ;
.It Ft void
.Fn uvm_scheduler "void" ;
-.It Ft void
-.Fn uvm_swapin "struct lwp *l" ;
.El
.Pp
.Fn uvm_pageout
@@ -689,9 +687,6 @@
system has finished starting other processes.
It handles the swapping in of runnable, swapped out processes in priority
order.
-.Pp
-.Fn uvm_swapin
-swaps in the named lwp.
.Sh PAGE LOAN
.Bl -ohang
.It Ft int
@@ -770,7 +765,7 @@
.It Ft void
.Fn uvm_meter "void" ;
.It Ft void
-.Fn uvm_fork "struct lwp *l1" "struct lwp *l2" "bool shared" ;
+.Fn uvm_proc_fork "struct proc *p1" "struct proc *p2" "bool shared" ;
.It Ft int
.Fn uvm_grow "struct proc *p" "vaddr_t sp" ;
.It Ft void
@@ -836,9 +831,9 @@
These functions are normally used to wire memory for I/O.
.Pp
.Fn uvm_meter
Home |
Main Index |
Thread Index |
Old Index