Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys First sweep at scheduler state cleanup. Collect MI sche...
details: https://anonhg.NetBSD.org/src/rev/eb0cb1b2b0f3
branches: trunk
changeset: 486617:eb0cb1b2b0f3
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri May 26 21:19:19 2000 +0000
description:
First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:
- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.
- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).
- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.
- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.
Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
diffstat:
sys/arch/alpha/alpha/cpu.c | 6 +-
sys/arch/alpha/alpha/dec_kn300.c | 6 +-
sys/arch/alpha/alpha/dec_kn8ae.c | 6 +-
sys/arch/alpha/alpha/genassym.c | 6 +-
sys/arch/alpha/alpha/interrupt.c | 8 +-
sys/arch/alpha/alpha/locore.s | 16 ++--
sys/arch/alpha/alpha/machdep.c | 24 ++---
sys/arch/alpha/alpha/trap.c | 6 +-
sys/arch/alpha/include/cpu.h | 32 ++++----
sys/arch/amiga/amiga/locore.s | 14 +-
sys/arch/amiga/amiga/machdep.c | 5 +-
sys/arch/amiga/amiga/trap.c | 4 +-
sys/arch/amiga/include/cpu.h | 21 +++++-
sys/arch/amigappc/amigappc/locore.S | 16 ++--
sys/arch/amigappc/amigappc/machdep.c | 5 +-
sys/arch/amigappc/include/cpu.h | 19 +++++
sys/arch/arc/arc/machdep.c | 5 +-
sys/arch/arc/include/cpu.h | 24 ++++++-
sys/arch/arm26/arm26/Locore.c | 25 +++---
sys/arch/arm26/arm26/except.c | 6 +-
sys/arch/arm26/arm26/machdep.c | 7 +-
sys/arch/arm26/include/cpu.h | 22 +++++-
sys/arch/arm32/arm32/ast.c | 4 +-
sys/arch/arm32/arm32/cpuswitch.S | 6 +-
sys/arch/arm32/arm32/machdep.c | 5 +-
sys/arch/arm32/arm32/undefined.c | 4 +-
sys/arch/arm32/fpe-arm/armfpe_init.c | 4 +-
sys/arch/arm32/include/cpu.h | 18 ++++-
sys/arch/atari/atari/locore.s | 12 +-
sys/arch/atari/atari/machdep.c | 5 +-
sys/arch/atari/atari/trap.c | 4 +-
sys/arch/atari/include/cpu.h | 22 +++++-
sys/arch/bebox/bebox/locore.s | 16 ++--
sys/arch/bebox/bebox/machdep.c | 5 +-
sys/arch/bebox/include/cpu.h | 21 +++++-
sys/arch/cobalt/cobalt/machdep.c | 5 +-
sys/arch/cobalt/include/cpu.h | 24 ++++++-
sys/arch/evbsh3/evbsh3/locore.s | 12 +-
sys/arch/hp300/hp300/locore.s | 12 +-
sys/arch/hp300/hp300/machdep.c | 5 +-
sys/arch/hp300/hp300/trap.c | 4 +-
sys/arch/hp300/include/cpu.h | 22 +++++-
sys/arch/hpcmips/hpcmips/machdep.c | 7 +-
sys/arch/hpcmips/include/cpu.h | 24 ++++++-
sys/arch/hpcmips/vr/vr_idle.S | 4 +-
sys/arch/i386/i386/locore.s | 21 +++--
sys/arch/i386/i386/machdep.c | 5 +-
sys/arch/i386/i386/svr4_machdep.c | 12 ++-
sys/arch/i386/i386/trap.c | 4 +-
sys/arch/i386/include/cpu.h | 22 +++++-
sys/arch/luna68k/include/cpu.h | 22 +++++-
sys/arch/luna68k/luna68k/locore.s | 12 +-
sys/arch/luna68k/luna68k/machdep.c | 7 +-
sys/arch/luna68k/luna68k/trap.c | 6 +-
sys/arch/m68k/m68k/proc_subr.s | 14 +-
sys/arch/mac68k/include/cpu.h | 22 +++++-
sys/arch/mac68k/mac68k/locore.s | 12 +-
sys/arch/mac68k/mac68k/machdep.c | 5 +-
sys/arch/mac68k/mac68k/trap.c | 4 +-
sys/arch/macppc/include/cpu.h | 21 +++++-
sys/arch/macppc/macppc/locore.S | 16 ++--
sys/arch/macppc/macppc/machdep.c | 5 +-
sys/arch/mips/include/cpu.h | 3 +-
sys/arch/mips/mips/locore.S | 24 +++---
sys/arch/mips/mips/trap.c | 6 +-
sys/arch/mmeye/mmeye/locore.s | 8 +-
sys/arch/mvme68k/include/cpu.h | 22 +++++-
sys/arch/mvme68k/mvme68k/locore.s | 12 +-
sys/arch/mvme68k/mvme68k/machdep.c | 5 +-
sys/arch/mvme68k/mvme68k/trap.c | 4 +-
sys/arch/news68k/include/cpu.h | 22 +++++-
sys/arch/news68k/news68k/locore.s | 12 +-
sys/arch/news68k/news68k/machdep.c | 5 +-
sys/arch/news68k/news68k/trap.c | 4 +-
sys/arch/newsmips/include/cpu.h | 21 +++++-
sys/arch/newsmips/newsmips/machdep.c | 7 +-
sys/arch/next68k/include/cpu.h | 21 +++++-
sys/arch/next68k/next68k/locore.s | 12 +-
sys/arch/next68k/next68k/machdep.c | 5 +-
sys/arch/next68k/next68k/trap.c | 4 +-
sys/arch/ofppc/include/cpu.h | 21 +++++-
sys/arch/ofppc/ofppc/locore.S | 16 ++--
sys/arch/ofppc/ofppc/machdep.c | 5 +-
sys/arch/pc532/include/cpu.h | 21 +++++-
sys/arch/pc532/pc532/locore.s | 18 ++--
sys/arch/pc532/pc532/machdep.c | 5 +-
sys/arch/pc532/pc532/trap.c | 4 +-
sys/arch/pmax/include/cpu.h | 24 ++++++-
sys/arch/pmax/pmax/machdep.c | 7 +-
sys/arch/powerpc/powerpc/Locore.c | 15 +--
sys/arch/powerpc/powerpc/trap.c | 6 +-
sys/arch/prep/include/cpu.h | 21 +++++-
sys/arch/prep/prep/locore.s | 16 ++--
sys/arch/prep/prep/machdep.c | 5 +-
sys/arch/sh3/include/cpu.h | 21 +++++-
sys/arch/sh3/sh3/Locore.c | 27 ++++---
sys/arch/sh3/sh3/sh3_machdep.c | 5 +-
sys/arch/sh3/sh3/trap.c | 4 +-
sys/arch/sparc/include/cpu.h | 7 +-
sys/arch/sparc/include/proc.h | 10 +--
sys/arch/sparc/sparc/cpuvar.h | 17 +++-
sys/arch/sparc/sparc/genassym.cf | 4 +-
sys/arch/sparc/sparc/locore.s | 16 +--
sys/arch/sparc/sparc/locore2.c | 13 +-
sys/arch/sparc/sparc/svr4_machdep.c | 12 ++-
sys/arch/sparc/sparc/trap.c | 4 +-
sys/arch/sparc64/include/cpu.h | 20 +++++-
sys/arch/sparc64/sparc64/locore.s | 16 +--
sys/arch/sparc64/sparc64/locore2.c | 15 +--
sys/arch/sparc64/sparc64/machdep.c | 5 +-
sys/arch/sparc64/sparc64/svr4_machdep.c | 12 ++-
sys/arch/sparc64/sparc64/trap.c | 4 +-
sys/arch/sun3/include/cpu.h | 19 ++++-
sys/arch/sun3/sun3/locore.s | 10 +-
sys/arch/sun3/sun3/machdep.c | 5 +-
sys/arch/sun3/sun3/trap.c | 4 +-
sys/arch/sun3/sun3x/locore.s | 10 +-
sys/arch/sun3/sun3x/machdep.c | 5 +-
sys/arch/vax/include/cpu.h | 23 ++++--
sys/arch/vax/vax/machdep.c | 3 +-
sys/arch/vax/vax/subr.s | 18 ++--
sys/arch/vax/vax/trap.c | 4 +-
sys/arch/vax/vax/vm_machdep.c | 4 +-
sys/arch/x68k/include/cpu.h | 19 ++++-
sys/arch/x68k/x68k/locore.s | 12 +-
sys/arch/x68k/x68k/machdep.c | 5 +-
sys/arch/x68k/x68k/trap.c | 4 +-
sys/kern/init_main.c | 6 +-
sys/kern/kern_ktrace.c | 4 +-
sys/kern/kern_resource.c | 12 ++-
sys/kern/kern_subr.c | 5 +-
sys/kern/kern_synch.c | 66 ++++++++----------
sys/kern/kern_time.c | 5 +-
sys/sys/proc.h | 23 +-----
sys/sys/sched.h | 116 ++++++++++++++++++++++++-------
sys/sys/systm.h | 4 +-
sys/uvm/uvm_page.c | 6 +-
137 files changed, 1187 insertions(+), 536 deletions(-)
diffs (truncated from 5101 to 300 lines):
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/cpu.c
--- a/sys/arch/alpha/alpha/cpu.c Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/cpu.c Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $ */
+/* $NetBSD: cpu.c,v 1.45 2000/05/26 21:19:19 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.45 2000/05/26 21:19:19 thorpej Exp $");
#include "opt_multiprocessor.h"
@@ -102,6 +102,7 @@
#else
paddr_t curpcb; /* PA of our current context */
struct proc *fpcurproc; /* current owner of FPU */
+struct cpu_info cpu_info_store;
#endif /* MULTIPROCESSOR */
/*
@@ -296,7 +297,6 @@
}
ci = &cpu_info[ma->ma_slot];
- simple_lock_init(&ci->ci_slock);
ci->ci_cpuid = ma->ma_slot;
ci->ci_dev = dev;
#endif /* MULTIPROCESSOR */
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/dec_kn300.c
--- a/sys/arch/alpha/alpha/dec_kn300.c Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/dec_kn300.c Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_kn300.c,v 1.15 2000/05/22 20:09:12 thorpej Exp $ */
+/* $NetBSD: dec_kn300.c,v 1.16 2000/05/26 21:19:20 thorpej Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.15 2000/05/22 20:09:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.16 2000/05/26 21:19:20 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -413,7 +413,7 @@
/*
* If we expected a machine check, just go handle it in common code.
*/
- mcp = cpu_mchkinfo();
+ mcp = &curcpu()->ci_mcinfo;
if (mcp->mc_expected) {
machine_check(mces, framep, type, logout);
return;
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/dec_kn8ae.c
--- a/sys/arch/alpha/alpha/dec_kn8ae.c Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/dec_kn8ae.c Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_kn8ae.c,v 1.23 1999/04/15 22:13:41 thorpej Exp $ */
+/* $NetBSD: dec_kn8ae.c,v 1.24 2000/05/26 21:19:20 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_kn8ae.c,v 1.23 1999/04/15 22:13:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_kn8ae.c,v 1.24 2000/05/26 21:19:20 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -483,7 +483,7 @@
/*
* If we expected a machine check, just go handle it in common code.
*/
- mcp = cpu_mchkinfo();
+ mcp = &curcpu()->ci_mcinfo;
if (mcp->mc_expected) {
machine_check(mces, framep, type, logout);
return;
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/genassym.c
--- a/sys/arch/alpha/alpha/genassym.c Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/genassym.c Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genassym.c,v 1.27 2000/05/26 00:36:42 thorpej Exp $ */
+/* $NetBSD: genassym.c,v 1.28 2000/05/26 21:19:21 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@@ -62,15 +62,15 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__RCSID("$NetBSD: genassym.c,v 1.27 2000/05/26 00:36:42 thorpej Exp $");
+__RCSID("$NetBSD: genassym.c,v 1.28 2000/05/26 21:19:21 thorpej Exp $");
#include <sys/param.h>
#include <sys/buf.h>
#include <sys/map.h>
#include <sys/proc.h>
+#include <sys/sched.h>
#include <sys/mbuf.h>
#include <sys/msgbuf.h>
-#include <sys/syscall.h>
#include <sys/user.h>
#include <sys/syscall.h>
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.45 2000/05/26 21:19:21 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.45 2000/05/26 21:19:21 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -193,7 +193,7 @@
const char *type;
struct mchkinfo *mcp;
- mcp = cpu_mchkinfo();
+ mcp = &curcpu()->ci_mcinfo;
/* Make sure it's an error we know about. */
if ((mces & (ALPHA_MCES_MIP|ALPHA_MCES_SCE|ALPHA_MCES_PCE)) == 0) {
type = "fatal machine check or error (unknown type)";
@@ -257,7 +257,7 @@
size_t size;
void *rptr;
{
- struct mchkinfo *mcp = cpu_mchkinfo();
+ struct mchkinfo *mcp = &curcpu()->ci_mcinfo;
long rcpt;
int rv;
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/locore.s Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.73 2000/05/26 00:36:42 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.74 2000/05/26 21:19:22 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.73 2000/05/26 00:36:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.74 2000/05/26 21:19:22 thorpej Exp $");
#ifndef EVCNT_COUNTERS
#include <machine/intrcnt.h>
@@ -766,7 +766,7 @@
/**************************************************************************/
-IMPORT(whichqs, 4)
+IMPORT(sched_whichqs, 4)
IMPORT(want_resched, 8)
IMPORT(kernel_lev1map, 8)
@@ -784,7 +784,7 @@
stq zero, 0(t1) /* curproc <- NULL for stats */
mov zero, a0 /* enable all interrupts */
call_pal PAL_OSF1_swpipl
-2: ldl t0, whichqs /* look for non-empty queue */
+2: ldl t0, sched_whichqs /* look for non-empty queue */
beq t0, 2b
ldiq a0, ALPHA_PSL_IPL_HIGH /* disable all interrupts */
call_pal PAL_OSF1_swpipl
@@ -819,7 +819,7 @@
mov a0, s0 /* save old curproc */
mov a1, s1 /* save old U-area */
- ldl t0, whichqs /* look for non-empty queue */
+ ldl t0, sched_whichqs /* look for non-empty queue */
beq t0, idle /* and if none, go idle */
ldiq a0, ALPHA_PSL_IPL_HIGH /* disable all interrupts */
@@ -827,7 +827,7 @@
cpu_switch_queuescan:
br pv, 1f
1: LDGP(pv)
- ldl t0, whichqs /* look for non-empty queue */
+ ldl t0, sched_whichqs /* look for non-empty queue */
beq t0, idle /* and if none, go idle */
mov t0, t3 /* t3 = saved whichqs */
mov zero, t2 /* t2 = lowest bit set */
@@ -840,7 +840,7 @@
3: /*
* Remove process from queue
*/
- lda t1, qs /* get queues */
+ lda t1, sched_qs /* get queues */
sll t2, 4, t0 /* queue head is 16 bytes */
addq t1, t0, t0 /* t0 = qp = &qs[firstbit] */
@@ -859,7 +859,7 @@
ldiq t0, 1 /* compute bit in whichqs */
sll t0, t2, t0
xor t3, t0, t3 /* clear bit in whichqs */
- stl t3, whichqs
+ stl t3, sched_whichqs
5:
mov t4, s2 /* save new proc */
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.206 2000/05/23 05:12:54 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.207 2000/05/26 21:19:22 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.206 2000/05/23 05:12:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.207 2000/05/26 21:19:22 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -87,6 +87,7 @@
#include <sys/kernel.h>
#include <sys/map.h>
#include <sys/proc.h>
+#include <sys/sched.h>
#include <sys/buf.h>
#include <sys/reboot.h>
#include <sys/device.h>
@@ -221,11 +222,6 @@
/* number of cpus in the box. really! */
int ncpus;
-#if !defined(MULTIPROCESSOR)
-/* A single machine check info structure for single CPU configurations. */
-struct mchkinfo mchkinfo_store;
-#endif
-
struct bootinfo_kernel bootinfo;
/* For built-in TCDS */
@@ -1903,11 +1899,11 @@
panic("setrunqueue");
bit = p->p_priority >> 2;
- whichqs |= (1 << bit);
- p->p_forw = (struct proc *)&qs[bit];
- p->p_back = qs[bit].ph_rlink;
+ sched_whichqs |= (1 << bit);
+ p->p_forw = (struct proc *)&sched_qs[bit];
+ p->p_back = sched_qs[bit].ph_rlink;
p->p_back->p_forw = p;
- qs[bit].ph_rlink = p;
+ sched_qs[bit].ph_rlink = p;
}
/*
@@ -1922,15 +1918,15 @@
int bit;
bit = p->p_priority >> 2;
- if ((whichqs & (1 << bit)) == 0)
+ if ((sched_whichqs & (1 << bit)) == 0)
panic("remrunqueue");
p->p_back->p_forw = p->p_forw;
p->p_forw->p_back = p->p_back;
p->p_back = NULL; /* for firewall checking. */
- if ((struct proc *)&qs[bit] == qs[bit].ph_link)
- whichqs &= ~(1 << bit);
+ if ((struct proc *)&sched_qs[bit] == sched_qs[bit].ph_link)
+ sched_whichqs &= ~(1 << bit);
}
/*
diff -r f350f21d12ec -r eb0cb1b2b0f3 sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c Fri May 26 21:11:00 2000 +0000
+++ b/sys/arch/alpha/alpha/trap.c Fri May 26 21:19:19 2000 +0000
@@ -1,4 +1,4 @@
Home |
Main Index |
Thread Index |
Old Index