summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-05-16 17:27:32 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-05-16 17:27:32 +0000
commita5055ebb8629500104a3b1d3dc614f04db4f363e (patch)
treee7ea33d78c280d57703780e4a90cb563f4d674b4
parent12c89e80fa52a6fdd0b959dbe94d18e61053d63e (diff)
The world of __HAVEs and __HAVE_NOTs is reducing. All architectures
have cpu_info now, so kill the option. eyeballed by jsg@ and grange@
-rw-r--r--sys/arch/alpha/include/_types.h3
-rw-r--r--sys/arch/amd64/include/_types.h3
-rw-r--r--sys/arch/arm/include/_types.h4
-rw-r--r--sys/arch/hppa/include/_types.h5
-rw-r--r--sys/arch/hppa64/include/_types.h5
-rw-r--r--sys/arch/i386/include/_types.h3
-rw-r--r--sys/arch/m68k/include/_types.h5
-rw-r--r--sys/arch/m88k/include/_types.h5
-rw-r--r--sys/arch/mips64/include/_types.h3
-rw-r--r--sys/arch/powerpc/include/_types.h3
-rw-r--r--sys/arch/sh/include/_types.h3
-rw-r--r--sys/arch/sparc/include/_types.h4
-rw-r--r--sys/arch/sparc64/include/_types.h3
-rw-r--r--sys/arch/vax/include/_types.h5
-rw-r--r--sys/kern/init_main.c15
-rw-r--r--sys/kern/kern_clock.c42
-rw-r--r--sys/kern/kern_fork.c4
-rw-r--r--sys/kern/kern_ktrace.c6
-rw-r--r--sys/kern/kern_subr.c6
-rw-r--r--sys/kern/kern_synch.c10
-rw-r--r--sys/kern/kern_sysctl.c15
-rw-r--r--sys/kern/sched_bsd.c79
-rw-r--r--sys/sys/kernel.h5
-rw-r--r--sys/sys/proc.h22
-rw-r--r--sys/sys/sched.h7
25 files changed, 35 insertions, 230 deletions
diff --git a/sys/arch/alpha/include/_types.h b/sys/arch/alpha/include/_types.h
index 18535caa90b..aa00ab491b3 100644
--- a/sys/arch/alpha/include/_types.h
+++ b/sys/arch/alpha/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.8 2007/05/15 15:23:35 art Exp $ */
+/* $OpenBSD: _types.h,v 1.9 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -119,7 +119,6 @@ typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
-#define __HAVE_CPUINFO
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_TIMECOUNTER
diff --git a/sys/arch/amd64/include/_types.h b/sys/arch/amd64/include/_types.h
index 07aefab326c..ad32a2a8138 100644
--- a/sys/arch/amd64/include/_types.h
+++ b/sys/arch/amd64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:35 art Exp $ */
+/* $OpenBSD: _types.h,v 1.4 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -116,7 +116,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_CPUINFO
#define __HAVE_TIMECOUNTER
#endif /* _AMD64__TYPES_H_ */
diff --git a/sys/arch/arm/include/_types.h b/sys/arch/arm/include/_types.h
index db38d11fbd2..ea013402cad 100644
--- a/sys/arch/arm/include/_types.h
+++ b/sys/arch/arm/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.4 2007/05/14 07:07:09 art Exp $ */
+/* $OpenBSD: _types.h,v 1.5 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -119,6 +119,4 @@ typedef void * __wctype_t;
#define __PROG32 /* indicate 32-bit mode */
#endif
-#define __HAVE_CPUINFO
-
#endif /* _ARM__TYPES_H_ */
diff --git a/sys/arch/hppa/include/_types.h b/sys/arch/hppa/include/_types.h
index ebe380ad296..fa5d1168746 100644
--- a/sys/arch/hppa/include/_types.h
+++ b/sys/arch/hppa/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:35 art Exp $ */
+/* $OpenBSD: _types.h,v 1.7 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -122,7 +122,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-/* Feature test macros */
-#define __HAVE_CPUINFO
-
#endif /* _HPPA__TYPES_H_ */
diff --git a/sys/arch/hppa64/include/_types.h b/sys/arch/hppa64/include/_types.h
index d05448fda15..02b161c0eff 100644
--- a/sys/arch/hppa64/include/_types.h
+++ b/sys/arch/hppa64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2007/05/15 01:56:46 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -118,7 +118,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-/* Feature test macros */
-#define __HAVE_CPUINFO
-
#endif /* _HPPA64__TYPES_H_ */
diff --git a/sys/arch/i386/include/_types.h b/sys/arch/i386/include/_types.h
index b6ae4922594..4fc270e483e 100644
--- a/sys/arch/i386/include/_types.h
+++ b/sys/arch/i386/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:35 art Exp $ */
+/* $OpenBSD: _types.h,v 1.7 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -115,7 +115,6 @@ typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
-#define __HAVE_CPUINFO
#define __HAVE_TIMECOUNTER
#endif /* _I386__TYPES_H_ */
diff --git a/sys/arch/m68k/include/_types.h b/sys/arch/m68k/include/_types.h
index f51e71a3b11..4073832a445 100644
--- a/sys/arch/m68k/include/_types.h
+++ b/sys/arch/m68k/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.5 2007/05/15 15:23:36 art Exp $ */
+/* $OpenBSD: _types.h,v 1.6 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -114,7 +114,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-/* Feature test macros */
-#define __HAVE_CPUINFO
-
#endif /* _M68K__TYPES_H_ */
diff --git a/sys/arch/m88k/include/_types.h b/sys/arch/m88k/include/_types.h
index bb8f7fca0ad..718e177981e 100644
--- a/sys/arch/m88k/include/_types.h
+++ b/sys/arch/m88k/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:36 art Exp $ */
+/* $OpenBSD: _types.h,v 1.4 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -115,7 +115,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-/* Feature test macros */
-#define __HAVE_CPUINFO
-
#endif /* _M88K__TYPES_H_ */
diff --git a/sys/arch/mips64/include/_types.h b/sys/arch/mips64/include/_types.h
index 765e071bd88..37ad2cde899 100644
--- a/sys/arch/mips64/include/_types.h
+++ b/sys/arch/mips64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.3 2007/05/07 18:42:12 kettenis Exp $ */
+/* $OpenBSD: _types.h,v 1.4 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -132,7 +132,6 @@ typedef struct label_t {
#define __SWAP_BROKEN
/* Feature test macros */
-#define __HAVE_CPUINFO
#define __HAVE_TIMECOUNTER
#endif /* _MIPS64__TYPES_H_ */
diff --git a/sys/arch/powerpc/include/_types.h b/sys/arch/powerpc/include/_types.h
index b7666a54410..a89a4434cb3 100644
--- a/sys/arch/powerpc/include/_types.h
+++ b/sys/arch/powerpc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:36 art Exp $ */
+/* $OpenBSD: _types.h,v 1.7 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -116,7 +116,6 @@ typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
-#define __HAVE_CPUINFO
#define __HAVE_TIMECOUNTER
#endif /* _POWERPC__TYPES_H_ */
diff --git a/sys/arch/sh/include/_types.h b/sys/arch/sh/include/_types.h
index d382015007c..7756280fc4c 100644
--- a/sys/arch/sh/include/_types.h
+++ b/sys/arch/sh/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.4 2007/05/15 15:23:36 art Exp $ */
+/* $OpenBSD: _types.h,v 1.5 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -117,6 +117,5 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_CPUINFO
#endif /* _SH__TYPES_H_ */
diff --git a/sys/arch/sparc/include/_types.h b/sys/arch/sparc/include/_types.h
index 0978cc65b61..b2ef3e869a4 100644
--- a/sys/arch/sparc/include/_types.h
+++ b/sys/arch/sparc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.7 2007/05/15 15:23:36 art Exp $ */
+/* $OpenBSD: _types.h,v 1.8 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -114,6 +114,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-#define __HAVE_CPUINFO
-
#endif /* _SPARC__TYPES_H_ */
diff --git a/sys/arch/sparc64/include/_types.h b/sys/arch/sparc64/include/_types.h
index 9707c260acf..c9b18cf22b6 100644
--- a/sys/arch/sparc64/include/_types.h
+++ b/sys/arch/sparc64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:36 art Exp $ */
+/* $OpenBSD: _types.h,v 1.7 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -122,7 +122,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_CPUINFO
#define __HAVE_TIMECOUNTER
#endif /* _SPARC64__TYPES_H_ */
diff --git a/sys/arch/vax/include/_types.h b/sys/arch/vax/include/_types.h
index d034229480d..88f19e3b5be 100644
--- a/sys/arch/vax/include/_types.h
+++ b/sys/arch/vax/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.6 2007/05/16 05:21:00 miod Exp $ */
+/* $OpenBSD: _types.h,v 1.7 2007/05/16 17:27:30 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -114,7 +114,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-/* Feature test macros */
-#define __HAVE_CPUINFO
-
#endif /* _MACHINE__TYPES_H_ */
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index a8cf415a9df..46f9faf3ade 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.139 2007/04/12 22:14:15 tedu Exp $ */
+/* $OpenBSD: init_main.c,v 1.140 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -113,9 +113,6 @@ struct pcred cred0;
struct plimit limit0;
struct vmspace vmspace0;
struct sigacts sigacts0;
-#if !defined(__HAVE_CPUINFO) && !defined(curproc)
-struct proc *curproc;
-#endif
struct proc *initproc;
int cmask = CMASK;
@@ -125,9 +122,6 @@ void (*md_diskconf)(void) = NULL;
struct vnode *rootvp, *swapdev_vp;
int boothowto;
struct timeval boottime;
-#ifndef __HAVE_CPUINFO
-struct timeval runtime;
-#endif
int ncpus = 1;
__volatile int start_init_exec; /* semaphore for start_init() */
@@ -199,9 +193,7 @@ main(void *framep)
* any possible traps/probes to simplify trap processing.
*/
curproc = p = &proc0;
-#ifdef __HAVE_CPUINFO
p->p_cpu = curcpu();
-#endif
/*
* Initialize timeouts.
@@ -484,14 +476,9 @@ main(void *framep)
#else
boottime = mono_time = time;
#endif
-#ifndef __HAVE_CPUINFO
- microuptime(&runtime);
-#endif
LIST_FOREACH(p, &allproc, p_list) {
p->p_stats->p_start = boottime;
-#ifdef __HAVE_CPUINFO
microuptime(&p->p_cpu->ci_schedstate.spc_runtime);
-#endif
p->p_rtime.tv_sec = p->p_rtime.tv_usec = 0;
}
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index fa1ed4d7450..f4e18101952 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.63 2007/04/17 17:57:32 miod Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.64 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@@ -226,9 +226,7 @@ hardclock(struct clockframe *frame)
extern int64_t ntp_tick_permanent;
extern int64_t ntp_tick_acc;
#endif
-#ifdef __HAVE_CPUINFO
struct cpu_info *ci = curcpu();
-#endif
p = curproc;
if (p && ((p->p_flag & (P_SYSTEM | P_WEXIT)) == 0)) {
@@ -253,7 +251,6 @@ hardclock(struct clockframe *frame)
if (stathz == 0)
statclock(frame);
-#if defined(__HAVE_CPUINFO)
if (--ci->ci_schedstate.spc_rrticks <= 0)
roundrobin(ci);
@@ -263,7 +260,6 @@ hardclock(struct clockframe *frame)
*/
if (CPU_IS_PRIMARY(ci) == 0)
return;
-#endif
#ifndef __HAVE_TIMECOUNTER
/*
@@ -482,15 +478,10 @@ statclock(struct clockframe *frame)
struct gmonparam *g;
int i;
#endif
-#ifdef __HAVE_CPUINFO
struct cpu_info *ci = curcpu();
struct schedstate_percpu *spc = &ci->ci_schedstate;
-#else
- static int schedclk;
-#endif
struct proc *p = curproc;
-#ifdef __HAVE_CPUINFO
/*
* Notice changes in divisor frequency, and adjust clock
* frequency accordingly.
@@ -505,15 +496,10 @@ statclock(struct clockframe *frame)
}
}
-/* XXX Kludgey */
-#define pscnt spc->spc_pscnt
-#define cp_time spc->spc_cp_time
-#endif
-
if (CLKF_USERMODE(frame)) {
if (p->p_flag & P_PROFIL)
addupc_intr(p, CLKF_PC(frame));
- if (--pscnt > 0)
+ if (--spc->spc_pscnt > 0)
return;
/*
* Came from user mode; CPU was in user state.
@@ -521,9 +507,9 @@ statclock(struct clockframe *frame)
*/
p->p_uticks++;
if (p->p_nice > NZERO)
- cp_time[CP_NICE]++;
+ spc->spc_cp_time[CP_NICE]++;
else
- cp_time[CP_USER]++;
+ spc->spc_cp_time[CP_USER]++;
} else {
#ifdef GPROF
/*
@@ -542,7 +528,7 @@ statclock(struct clockframe *frame)
if (p != NULL && p->p_flag & P_PROFIL)
addupc_intr(p, PROC_PC(p));
#endif
- if (--pscnt > 0)
+ if (--spc->spc_pscnt > 0)
return;
/*
* Came from kernel mode, so we were:
@@ -559,19 +545,14 @@ statclock(struct clockframe *frame)
if (CLKF_INTR(frame)) {
if (p != NULL)
p->p_iticks++;
- cp_time[CP_INTR]++;
+ spc->spc_cp_time[CP_INTR]++;
} else if (p != NULL) {
p->p_sticks++;
- cp_time[CP_SYS]++;
+ spc->spc_cp_time[CP_SYS]++;
} else
- cp_time[CP_IDLE]++;
+ spc->spc_cp_time[CP_IDLE]++;
}
- pscnt = psdiv;
-
-#ifdef __HAVE_CPUINFO
-#undef pscnt
-#undef cp_time
-#endif
+ spc->spc_pscnt = psdiv;
if (p != NULL) {
p->p_cpticks++;
@@ -580,14 +561,9 @@ statclock(struct clockframe *frame)
* ~~16 Hz is best
*/
if (schedhz == 0) {
-#ifdef __HAVE_CPUINFO
if ((++curcpu()->ci_schedstate.spc_schedticks & 3) ==
0)
schedclock(p);
-#else
- if ((++schedclk & 3) == 0)
- schedclock(p);
-#endif
}
}
}
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 71941682d39..d4eb5fcc449 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.90 2007/04/12 22:14:15 tedu Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.91 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -254,9 +254,7 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
timeout_set(&p2->p_sleep_to, endtsleep, p2);
timeout_set(&p2->p_realit_to, realitexpire, p2);
-#if defined(__HAVE_CPUINFO)
p2->p_cpu = p1->p_cpu;
-#endif
/*
* Duplicate sub-structures as needed.
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index c65b8b78458..ce85d215862 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_ktrace.c,v 1.41 2006/11/14 09:16:55 deraadt Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.42 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
@@ -207,11 +207,7 @@ ktrgenio(struct proc *p, int fd, enum uio_rw rw, struct iovec *iov, int len,
* Don't allow this process to hog the cpu when doing
* huge I/O.
*/
-#ifdef __HAVE_CPUINFO
if (curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD)
-#else
- if (p->p_schedflags & PSCHED_SHOULDYIELD)
-#endif
preempt(NULL);
count = min(iov->iov_len, buflen);
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index 4835da16ec8..023a5867f25 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_subr.c,v 1.30 2005/11/28 00:14:29 jsg Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.31 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
@@ -75,12 +75,8 @@ uiomove(void *cp, int n, struct uio *uio)
switch (uio->uio_segflg) {
case UIO_USERSPACE:
-#ifdef __HAVE_CPUINFO
if (curcpu()->ci_schedstate.spc_schedflags &
SPCF_SHOULDYIELD)
-#else
- if (p->p_schedflags & PSCHED_SHOULDYIELD)
-#endif
preempt(NULL);
if (uio->uio_rw == UIO_READ)
error = copyout(cp, iov->iov_base, cnt);
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 5acff3ccad8..849dffefc57 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.79 2007/04/03 08:05:43 art Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.80 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -185,11 +185,7 @@ sleep_finish(struct sleep_state *sls, int do_sleep)
#endif
}
-#ifdef __HAVE_CPUINFO
p->p_cpu->ci_schedstate.spc_curpriority = p->p_usrpri;
-#else
- curpriority = p->p_usrpri;
-#endif
SCHED_UNLOCK(sls->sls_s);
/*
@@ -357,12 +353,8 @@ restart:
* resched_proc().
*/
setrunqueue(p);
-#ifdef __HAVE_CPUINFO
KASSERT(p->p_cpu != NULL);
need_resched(p->p_cpu);
-#else
- need_resched(NULL);
-#endif
/* END INLINE EXPANSION */
if (n != 0)
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 2c7f0459039..6cf0c7fc2fa 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.151 2007/04/18 16:57:06 art Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.152 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -433,7 +433,6 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_malloc(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen, p));
case KERN_CPTIME:
-#ifdef __HAVE_CPUINFO
{
CPU_INFO_ITERATOR cii;
struct cpu_info *ci;
@@ -445,10 +444,10 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
for (i = 0; i < CPUSTATES; i++)
cp_time[i] += ci->ci_schedstate.spc_cp_time[i];
}
- }
-#endif
+
return (sysctl_rdstruct(oldp, oldlenp, newp, &cp_time,
sizeof(cp_time)));
+ }
case KERN_NCHSTATS:
return (sysctl_rdstruct(oldp, oldlenp, newp, &nchstats,
sizeof(struct nchstats)));
@@ -533,11 +532,9 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
#endif
case KERN_MAXLOCKSPERUID:
return (sysctl_int(oldp, oldlenp, newp, newlen, &maxlocksperuid));
-#ifdef __HAVE_CPUINFO
case KERN_CPTIME2:
return (sysctl_cptime2(name + 1, namelen -1, oldp, oldlenp,
newp, newlen));
-#endif
default:
return (EOPNOTSUPP);
}
@@ -1290,11 +1287,7 @@ fill_kproc2(struct proc *p, struct kinfo_proc2 *ki)
ki->p_stat = p->p_stat;
ki->p_swtime = p->p_swtime;
ki->p_slptime = p->p_slptime;
-#ifdef __HAVE_CPUINFO
ki->p_schedflags = 0;
-#else
- ki->p_schedflags = p->p_schedflags;
-#endif
ki->p_holdcnt = 1;
ki->p_priority = p->p_priority;
ki->p_usrpri = p->p_usrpri;
@@ -1873,7 +1866,6 @@ sysctl_emul(int *name, u_int namelen, void *oldp, size_t *oldlenp,
#endif /* SMALL_KERNEL */
-#ifdef __HAVE_CPUINFO
int
sysctl_cptime2(int *name, u_int namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen)
@@ -1898,4 +1890,3 @@ sysctl_cptime2(int *name, u_int namelen, void *oldp, size_t *oldlenp,
&ci->ci_schedstate.spc_cp_time,
sizeof(ci->ci_schedstate.spc_cp_time)));
}
-#endif
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 699f4dd807a..186be456346 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.10 2007/02/06 18:42:37 art Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.11 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -54,13 +54,8 @@
#include <machine/cpu.h>
-#ifndef __HAVE_CPUINFO
-u_char curpriority; /* usrpri of curproc */
-#endif
int lbolt; /* once a second sleep address */
-#ifdef __HAVE_CPUINFO
int rrticks_init; /* # of hardclock ticks per roundrobin() */
-#endif
int whichqs; /* Bit mask summary of non-empty Q's. */
struct prochd qs[NQS];
@@ -69,11 +64,7 @@ struct SIMPLELOCK sched_lock;
void scheduler_start(void);
-#ifdef __HAVE_CPUINFO
void roundrobin(struct cpu_info *);
-#else
-void roundrobin(void *);
-#endif
void schedcpu(void *);
void updatepri(struct proc *);
void endtsleep(void *);
@@ -81,9 +72,6 @@ void endtsleep(void *);
void
scheduler_start(void)
{
-#ifndef __HAVE_CPUINFO
- static struct timeout roundrobin_to;
-#endif
static struct timeout schedcpu_to;
/*
@@ -93,16 +81,9 @@ scheduler_start(void)
* make them do their job.
*/
-#ifndef __HAVE_CPUINFO
- timeout_set(&roundrobin_to, roundrobin, &roundrobin_to);
-#endif
timeout_set(&schedcpu_to, schedcpu, &schedcpu_to);
-#ifdef __HAVE_CPUINFO
rrticks_init = hz / 10;
-#else
- roundrobin(&roundrobin_to);
-#endif
schedcpu(&schedcpu_to);
}
@@ -110,7 +91,6 @@ scheduler_start(void)
* Force switch among equal priority processes every 100ms.
*/
/* ARGSUSED */
-#ifdef __HAVE_CPUINFO
void
roundrobin(struct cpu_info *ci)
{
@@ -136,33 +116,6 @@ roundrobin(struct cpu_info *ci)
need_resched(curcpu());
}
-#else
-void
-roundrobin(void *arg)
-{
- struct timeout *to = (struct timeout *)arg;
- struct proc *p = curproc;
- int s;
-
- if (p != NULL) {
- s = splstatclock();
- if (p->p_schedflags & PSCHED_SEENRR) {
- /*
- * The process has already been through a roundrobin
- * without switching and may be hogging the CPU.
- * Indicate that the process should yield.
- */
- p->p_schedflags |= PSCHED_SHOULDYIELD;
- } else {
- p->p_schedflags |= PSCHED_SEENRR;
- }
- splx(s);
- }
-
- need_resched(NULL);
- timeout_add(to, hz / 10);
-}
-#endif
/*
* Constants for digital decay and forget:
@@ -422,9 +375,7 @@ mi_switch(void)
int hold_count;
int sched_count;
#endif
-#ifdef __HAVE_CPUINFO
struct schedstate_percpu *spc = &p->p_cpu->ci_schedstate;
-#endif
SCHED_ASSERT_LOCKED();
@@ -445,7 +396,6 @@ mi_switch(void)
* XXX - use microuptime here to avoid strangeness.
*/
microuptime(&tv);
-#ifdef __HAVE_CPUINFO
if (timercmp(&tv, &spc->spc_runtime, <)) {
#if 0
printf("uptime is not monotonic! "
@@ -457,18 +407,6 @@ mi_switch(void)
timersub(&tv, &spc->spc_runtime, &tv);
timeradd(&p->p_rtime, &tv, &p->p_rtime);
}
-#else
- if (timercmp(&tv, &runtime, <)) {
-#if 0
- printf("uptime is not monotonic! "
- "tv=%lu.%06lu, runtime=%lu.%06lu\n",
- tv.tv_sec, tv.tv_usec, runtime.tv_sec, runtime.tv_usec);
-#endif
- } else {
- timersub(&tv, &runtime, &tv);
- timeradd(&p->p_rtime, &tv, &p->p_rtime);
- }
-#endif
/*
* Check if the process exceeds its cpu resource allocation.
@@ -489,11 +427,7 @@ mi_switch(void)
* Process is about to yield the CPU; clear the appropriate
* scheduling flags.
*/
-#ifdef __HAVE_CPUINFO
spc->spc_schedflags &= ~SPCF_SWITCHCLEAR;
-#else
- p->p_schedflags &= ~PSCHED_SWITCHCLEAR;
-#endif
/*
* Pick a new current process and record its start time.
@@ -512,13 +446,9 @@ mi_switch(void)
* be running on a new CPU now, so don't use the cache'd
* schedstate_percpu pointer.
*/
-#ifdef __HAVE_CPUINFO
KDASSERT(p->p_cpu != NULL);
KDASSERT(p->p_cpu == curcpu());
microuptime(&p->p_cpu->ci_schedstate.spc_runtime);
-#else
- microuptime(&runtime);
-#endif
#if defined(MULTIPROCESSOR)
/*
@@ -549,9 +479,7 @@ rqinit(void)
static __inline void
resched_proc(struct proc *p, u_char pri)
{
-#ifdef __HAVE_CPUINFO
struct cpu_info *ci;
-#endif
/*
* XXXSMP
@@ -575,14 +503,9 @@ resched_proc(struct proc *p, u_char pri)
* There is also the issue of locking the other CPU's
* sched state, which we currently do not do.
*/
-#ifdef __HAVE_CPUINFO
ci = (p->p_cpu != NULL) ? p->p_cpu : curcpu();
if (pri < ci->ci_schedstate.spc_curpriority)
need_resched(ci);
-#else
- if (pri < curpriority)
- need_resched(NULL);
-#endif
}
/*
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index d14da10dbab..f0615ea2007 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kernel.h,v 1.11 2004/07/28 17:15:12 tholo Exp $ */
+/* $OpenBSD: kernel.h,v 1.12 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: kernel.h,v 1.11 1995/03/03 01:24:16 cgd Exp $ */
/*-
@@ -48,9 +48,6 @@ extern int domainnamelen;
/* 1.2 */
extern struct timeval boottime;
-#ifndef __HAVE_CPUINFO
-extern struct timeval runtime;
-#endif
#ifndef __HAVE_TIMECOUNTER
extern volatile struct timeval mono_time;
extern volatile struct timeval time;
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 0c4733bda05..8af1af06d56 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.97 2007/05/08 11:16:31 art Exp $ */
+/* $OpenBSD: proc.h,v 1.98 2007/05/16 17:27:30 art Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -47,9 +47,7 @@
#include <sys/event.h> /* For struct klist */
#include <machine/atomic.h>
-#ifdef __HAVE_CPUINFO
#define curproc curcpu()->ci_curproc
-#endif
#ifdef _KERNEL
#define __need_process
#endif
@@ -198,11 +196,7 @@ struct proc {
const char *p_wmesg; /* Reason for sleep. */
u_int p_swtime; /* Time swapped in or out. */
u_int p_slptime; /* Time since last blocked. */
-#ifdef __HAVE_CPUINFO
struct cpu_info * __volatile p_cpu; /* CPU we're running on. */
-#else
- int p_schedflags; /* PSCHED_* flags */
-#endif
struct itimerval p_realtimer; /* Alarm timer. */
struct timeout p_realit_to; /* Alarm timeout. */
@@ -324,17 +318,6 @@ struct proc {
#define P_EXITSIG(p) \
(((p)->p_flag & P_TRACED) ? SIGCHLD : (p)->p_exitsig)
-#ifndef __HAVE_CPUINFO
-/*
- * These flags are kept in p_schedflags. p_schedflags may be modified
- * only at splstatclock().
- */
-#define PSCHED_SEENRR 0x0001 /* process has been in roundrobin() */
-#define PSCHED_SHOULDYIELD 0x0002 /* process should yield */
-
-#define PSCHED_SWITCHCLEAR (PSCHED_SEENRR|PSCHED_SHOULDYIELD)
-#endif
-
/*
* MOVE TO ucred.h?
*
@@ -403,9 +386,6 @@ extern u_long pidhash;
extern LIST_HEAD(pgrphashhead, pgrp) *pgrphashtbl;
extern u_long pgrphash;
-#if !defined(__HAVE_CPUINFO) && !defined(curproc)
-extern struct proc *curproc; /* Current running proc. */
-#endif
extern struct proc proc0; /* Process slot for swapper. */
extern int nprocs, maxproc; /* Current and max number of procs. */
extern int randompid; /* fork() should create random pid's */
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index f45101cd590..7f35dc91ada 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched.h,v 1.14 2007/02/03 16:48:23 miod Exp $ */
+/* $OpenBSD: sched.h,v 1.15 2007/05/16 17:27:31 art Exp $ */
/* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */
/*-
@@ -123,10 +123,8 @@ extern int rrticks_init; /* ticks per roundrobin() */
struct proc;
void schedclock(struct proc *);
-#ifdef __HAVE_CPUINFO
struct cpu_info;
void roundrobin(struct cpu_info *);
-#endif
/* Inherit the parent's scheduler history */
#define scheduler_fork_hook(parent, child) do { \
@@ -138,9 +136,6 @@ void roundrobin(struct cpu_info *);
(parent)->p_estcpu = ESTCPULIM((parent)->p_estcpu + (child)->p_estcpu);\
} while (0)
-#if !defined(__HAVE_CPUINFO) && !defined(splsched)
-#define splsched() splhigh()
-#endif
#ifndef IPL_SCHED
#define IPL_SCHED IPL_HIGH
#endif