- localize some definitions.

- use PPQ macro where appropriate.
This commit is contained in:
yamt 2005-10-30 20:28:56 +00:00
parent d17f6e14bc
commit a9894b0f08
2 changed files with 21 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_synch.c,v 1.151 2005/10/06 07:02:14 yamt Exp $ */
/* $NetBSD: kern_synch.c,v 1.152 2005/10/30 20:28:56 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.151 2005/10/06 07:02:14 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.152 2005/10/30 20:28:56 yamt Exp $");
#include "opt_ddb.h"
#include "opt_ktrace.h"
@ -111,6 +111,18 @@ __KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.151 2005/10/06 07:02:14 yamt Exp $"
int lbolt; /* once a second sleep address */
int rrticks; /* number of hardclock ticks per roundrobin() */
/*
* Sleep queues.
*
* We're only looking at 7 bits of the address; everything is
* aligned to 4, lots of things are aligned to greater powers
* of 2. Shift right by 8, i.e. drop the bottom 256 worth.
*/
#define SLPQUE_TABLESIZE 128
#define SLPQUE_LOOKUP(x) (((u_long)(x) >> 8) & (SLPQUE_TABLESIZE - 1))
#define SLPQUE(ident) (&sched_slpque[SLPQUE_LOOKUP(ident)])
/*
* The global scheduler state.
*/
@ -242,6 +254,10 @@ fixpt_t ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */
*/
#define CCPU_SHIFT 11
#define PPQ (128 / RUNQUE_NQS) /* priorities per queue */
#define NICE_WEIGHT 2 /* priorities per nice level */
#define ESTCPULIM(e) min((e), NICE_WEIGHT * PRIO_MAX - PPQ)
/*
* Recompute process priorities, every hz ticks.
*/
@ -1306,7 +1322,7 @@ setrunqueue(struct lwp *l)
{
struct prochd *rq;
struct lwp *prev;
const int whichq = l->l_priority / 4;
const int whichq = l->l_priority / PPQ;
#ifdef RQDEBUG
checkrunqueue(whichq, NULL);
@ -1331,7 +1347,7 @@ void
remrunqueue(struct lwp *l)
{
struct lwp *prev, *next;
const int whichq = l->l_priority / 4;
const int whichq = l->l_priority / PPQ;
#ifdef RQDEBUG
checkrunqueue(whichq, l);
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: sched.h,v 1.22 2005/10/06 07:02:13 yamt Exp $ */
/* $NetBSD: sched.h,v 1.23 2005/10/30 20:28:56 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
@ -101,13 +101,7 @@ struct sched_param {
/*
* Sleep queues.
*
* We're only looking at 7 bits of the address; everything is
* aligned to 4, lots of things are aligned to greater powers
* of 2. Shift right by 8, i.e. drop the bottom 256 worth.
*/
#define SLPQUE_TABLESIZE 128
#define SLPQUE_LOOKUP(x) (((u_long)(x) >> 8) & (SLPQUE_TABLESIZE - 1))
struct slpque {
struct lwp *sq_head;
struct lwp **sq_tailp;
@ -178,10 +172,6 @@ struct schedstate_percpu {
#ifdef _KERNEL
#define PPQ (128 / RUNQUE_NQS) /* priorities per queue */
#define NICE_WEIGHT 2 /* priorities per nice level */
#define ESTCPULIM(e) min((e), NICE_WEIGHT * PRIO_MAX - PPQ)
extern int schedhz; /* ideally: 16 */
extern int rrticks; /* ticks per roundrobin() */
@ -194,11 +184,8 @@ extern int rrticks; /* ticks per roundrobin() */
* in kern/kern_synch.c.
*/
extern struct prochd sched_qs[];
extern struct slpque sched_slpque[];
extern __volatile u_int32_t sched_whichqs;
#define SLPQUE(ident) (&sched_slpque[SLPQUE_LOOKUP(ident)])
struct proc;
struct cpu_info;