Home | History | Annotate | Line # | Download | only in uvm
uvm_pdpolicy_clock.c revision 1.12
      1  1.12       ad /*	$NetBSD: uvm_pdpolicy_clock.c,v 1.12 2008/06/04 12:41:40 ad Exp $	*/
      2   1.2     yamt /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
      3   1.2     yamt 
      4   1.2     yamt /*
      5   1.2     yamt  * Copyright (c) 1997 Charles D. Cranor and Washington University.
      6   1.2     yamt  * Copyright (c) 1991, 1993, The Regents of the University of California.
      7   1.2     yamt  *
      8   1.2     yamt  * All rights reserved.
      9   1.2     yamt  *
     10   1.2     yamt  * This code is derived from software contributed to Berkeley by
     11   1.2     yamt  * The Mach Operating System project at Carnegie-Mellon University.
     12   1.2     yamt  *
     13   1.2     yamt  * Redistribution and use in source and binary forms, with or without
     14   1.2     yamt  * modification, are permitted provided that the following conditions
     15   1.2     yamt  * are met:
     16   1.2     yamt  * 1. Redistributions of source code must retain the above copyright
     17   1.2     yamt  *    notice, this list of conditions and the following disclaimer.
     18   1.2     yamt  * 2. Redistributions in binary form must reproduce the above copyright
     19   1.2     yamt  *    notice, this list of conditions and the following disclaimer in the
     20   1.2     yamt  *    documentation and/or other materials provided with the distribution.
     21   1.2     yamt  * 3. All advertising materials mentioning features or use of this software
     22   1.2     yamt  *    must display the following acknowledgement:
     23   1.2     yamt  *	This product includes software developed by Charles D. Cranor,
     24   1.2     yamt  *      Washington University, the University of California, Berkeley and
     25   1.2     yamt  *      its contributors.
     26   1.2     yamt  * 4. Neither the name of the University nor the names of its contributors
     27   1.2     yamt  *    may be used to endorse or promote products derived from this software
     28   1.2     yamt  *    without specific prior written permission.
     29   1.2     yamt  *
     30   1.2     yamt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     31   1.2     yamt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     32   1.2     yamt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     33   1.2     yamt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     34   1.2     yamt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     35   1.2     yamt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     36   1.2     yamt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     37   1.2     yamt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     38   1.2     yamt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     39   1.2     yamt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     40   1.2     yamt  * SUCH DAMAGE.
     41   1.2     yamt  *
     42   1.2     yamt  *	@(#)vm_pageout.c        8.5 (Berkeley) 2/14/94
     43   1.2     yamt  * from: Id: uvm_pdaemon.c,v 1.1.2.32 1998/02/06 05:26:30 chs Exp
     44   1.2     yamt  *
     45   1.2     yamt  *
     46   1.2     yamt  * Copyright (c) 1987, 1990 Carnegie-Mellon University.
     47   1.2     yamt  * All rights reserved.
     48   1.2     yamt  *
     49   1.2     yamt  * Permission to use, copy, modify and distribute this software and
     50   1.2     yamt  * its documentation is hereby granted, provided that both the copyright
     51   1.2     yamt  * notice and this permission notice appear in all copies of the
     52   1.2     yamt  * software, derivative works or modified versions, and any portions
     53   1.2     yamt  * thereof, and that both notices appear in supporting documentation.
     54   1.2     yamt  *
     55   1.2     yamt  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     56   1.2     yamt  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     57   1.2     yamt  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     58   1.2     yamt  *
     59   1.2     yamt  * Carnegie Mellon requests users of this software to return to
     60   1.2     yamt  *
     61   1.2     yamt  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     62   1.2     yamt  *  School of Computer Science
     63   1.2     yamt  *  Carnegie Mellon University
     64   1.2     yamt  *  Pittsburgh PA 15213-3890
     65   1.2     yamt  *
     66   1.2     yamt  * any improvements or extensions that they make and grant Carnegie the
     67   1.2     yamt  * rights to redistribute these changes.
     68   1.2     yamt  */
     69   1.2     yamt 
     70   1.2     yamt #if defined(PDSIM)
     71   1.2     yamt 
     72   1.2     yamt #include "pdsim.h"
     73   1.2     yamt 
     74   1.2     yamt #else /* defined(PDSIM) */
     75   1.2     yamt 
     76   1.2     yamt #include <sys/cdefs.h>
     77  1.12       ad __KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.12 2008/06/04 12:41:40 ad Exp $");
     78   1.2     yamt 
     79   1.2     yamt #include <sys/param.h>
     80   1.2     yamt #include <sys/proc.h>
     81   1.2     yamt #include <sys/systm.h>
     82   1.2     yamt #include <sys/kernel.h>
     83   1.2     yamt 
     84   1.2     yamt #include <uvm/uvm.h>
     85   1.2     yamt #include <uvm/uvm_pdpolicy.h>
     86   1.2     yamt #include <uvm/uvm_pdpolicy_impl.h>
     87   1.2     yamt 
     88   1.2     yamt #endif /* defined(PDSIM) */
     89   1.2     yamt 
     90   1.2     yamt #define PQ_INACTIVE	PQ_PRIVATE1	/* page is in inactive list */
     91   1.2     yamt #define PQ_ACTIVE	PQ_PRIVATE2	/* page is in active list */
     92   1.2     yamt 
     93   1.2     yamt #if !defined(CLOCK_INACTIVEPCT)
     94   1.2     yamt #define	CLOCK_INACTIVEPCT	33
     95   1.2     yamt #endif /* !defined(CLOCK_INACTIVEPCT) */
     96   1.2     yamt 
     97   1.2     yamt struct uvmpdpol_globalstate {
     98   1.2     yamt 	struct pglist s_activeq;	/* allocated pages, in use */
     99   1.2     yamt 	struct pglist s_inactiveq;	/* pages between the clock hands */
    100   1.2     yamt 	int s_active;
    101   1.2     yamt 	int s_inactive;
    102   1.2     yamt 	int s_inactarg;
    103   1.2     yamt 	struct uvm_pctparam s_anonmin;
    104   1.2     yamt 	struct uvm_pctparam s_filemin;
    105   1.2     yamt 	struct uvm_pctparam s_execmin;
    106   1.2     yamt 	struct uvm_pctparam s_anonmax;
    107   1.2     yamt 	struct uvm_pctparam s_filemax;
    108   1.2     yamt 	struct uvm_pctparam s_execmax;
    109   1.2     yamt 	struct uvm_pctparam s_inactivepct;
    110   1.2     yamt };
    111   1.2     yamt 
    112   1.2     yamt struct uvmpdpol_scanstate {
    113   1.7  thorpej 	bool ss_first;
    114   1.7  thorpej 	bool ss_anonreact, ss_filereact, ss_execreact;
    115   1.2     yamt 	struct vm_page *ss_nextpg;
    116   1.2     yamt };
    117   1.2     yamt 
    118   1.2     yamt static struct uvmpdpol_globalstate pdpol_state;
    119   1.2     yamt static struct uvmpdpol_scanstate pdpol_scanstate;
    120   1.2     yamt 
    121   1.2     yamt PDPOL_EVCNT_DEFINE(reactexec)
    122   1.2     yamt PDPOL_EVCNT_DEFINE(reactfile)
    123   1.2     yamt PDPOL_EVCNT_DEFINE(reactanon)
    124   1.2     yamt 
    125   1.2     yamt static void
    126   1.2     yamt clock_tune(void)
    127   1.2     yamt {
    128   1.2     yamt 	struct uvmpdpol_globalstate *s = &pdpol_state;
    129   1.2     yamt 
    130   1.2     yamt 	s->s_inactarg = UVM_PCTPARAM_APPLY(&s->s_inactivepct,
    131   1.2     yamt 	    s->s_active + s->s_inactive);
    132   1.2     yamt 	if (s->s_inactarg <= uvmexp.freetarg) {
    133   1.2     yamt 		s->s_inactarg = uvmexp.freetarg + 1;
    134   1.2     yamt 	}
    135   1.2     yamt }
    136   1.2     yamt 
    137   1.2     yamt void
    138   1.2     yamt uvmpdpol_scaninit(void)
    139   1.2     yamt {
    140   1.2     yamt 	struct uvmpdpol_globalstate *s = &pdpol_state;
    141   1.2     yamt 	struct uvmpdpol_scanstate *ss = &pdpol_scanstate;
    142   1.2     yamt 	int t;
    143   1.7  thorpej 	bool anonunder, fileunder, execunder;
    144   1.7  thorpej 	bool anonover, fileover, execover;
    145   1.7  thorpej 	bool anonreact, filereact, execreact;
    146   1.2     yamt 
    147   1.2     yamt 	/*
    148   1.2     yamt 	 * decide which types of pages we want to reactivate instead of freeing
    149   1.2     yamt 	 * to keep usage within the minimum and maximum usage limits.
    150   1.2     yamt 	 */
    151   1.2     yamt 
    152   1.2     yamt 	t = s->s_active + s->s_inactive + uvmexp.free;
    153   1.2     yamt 	anonunder = uvmexp.anonpages <= UVM_PCTPARAM_APPLY(&s->s_anonmin, t);
    154   1.2     yamt 	fileunder = uvmexp.filepages <= UVM_PCTPARAM_APPLY(&s->s_filemin, t);
    155   1.2     yamt 	execunder = uvmexp.execpages <= UVM_PCTPARAM_APPLY(&s->s_execmin, t);
    156   1.2     yamt 	anonover = uvmexp.anonpages > UVM_PCTPARAM_APPLY(&s->s_anonmax, t);
    157   1.2     yamt 	fileover = uvmexp.filepages > UVM_PCTPARAM_APPLY(&s->s_filemax, t);
    158   1.2     yamt 	execover = uvmexp.execpages > UVM_PCTPARAM_APPLY(&s->s_execmax, t);
    159   1.2     yamt 	anonreact = anonunder || (!anonover && (fileover || execover));
    160   1.2     yamt 	filereact = fileunder || (!fileover && (anonover || execover));
    161   1.2     yamt 	execreact = execunder || (!execover && (anonover || fileover));
    162   1.2     yamt 	if (filereact && execreact && (anonreact || uvm_swapisfull())) {
    163   1.8  thorpej 		anonreact = filereact = execreact = false;
    164   1.2     yamt 	}
    165   1.2     yamt 	ss->ss_anonreact = anonreact;
    166   1.2     yamt 	ss->ss_filereact = filereact;
    167   1.2     yamt 	ss->ss_execreact = execreact;
    168   1.2     yamt 
    169   1.8  thorpej 	ss->ss_first = true;
    170   1.2     yamt }
    171   1.2     yamt 
    172   1.2     yamt struct vm_page *
    173   1.2     yamt uvmpdpol_selectvictim(void)
    174   1.2     yamt {
    175   1.2     yamt 	struct uvmpdpol_scanstate *ss = &pdpol_scanstate;
    176   1.2     yamt 	struct vm_page *pg;
    177   1.2     yamt 
    178   1.9       ad 	KASSERT(mutex_owned(&uvm_pageqlock));
    179   1.2     yamt 
    180   1.2     yamt 	while (/* CONSTCOND */ 1) {
    181   1.2     yamt 		struct vm_anon *anon;
    182   1.2     yamt 		struct uvm_object *uobj;
    183   1.2     yamt 
    184   1.2     yamt 		if (ss->ss_first) {
    185   1.2     yamt 			pg = TAILQ_FIRST(&pdpol_state.s_inactiveq);
    186   1.8  thorpej 			ss->ss_first = false;
    187   1.2     yamt 		} else {
    188   1.2     yamt 			pg = ss->ss_nextpg;
    189   1.2     yamt 			if (pg != NULL && (pg->pqflags & PQ_INACTIVE) == 0) {
    190   1.2     yamt 				pg = TAILQ_FIRST(&pdpol_state.s_inactiveq);
    191   1.2     yamt 			}
    192   1.2     yamt 		}
    193   1.2     yamt 		if (pg == NULL) {
    194   1.2     yamt 			break;
    195   1.2     yamt 		}
    196  1.12       ad 		ss->ss_nextpg = TAILQ_NEXT(pg, pageq.queue);
    197   1.2     yamt 
    198   1.2     yamt 		uvmexp.pdscans++;
    199   1.2     yamt 
    200   1.2     yamt 		/*
    201   1.2     yamt 		 * move referenced pages back to active queue and
    202   1.2     yamt 		 * skip to next page.
    203   1.2     yamt 		 */
    204   1.2     yamt 
    205   1.2     yamt 		if (pmap_is_referenced(pg)) {
    206   1.2     yamt 			uvmpdpol_pageactivate(pg);
    207   1.2     yamt 			uvmexp.pdreact++;
    208   1.2     yamt 			continue;
    209   1.2     yamt 		}
    210   1.2     yamt 
    211   1.2     yamt 		anon = pg->uanon;
    212   1.2     yamt 		uobj = pg->uobject;
    213   1.2     yamt 
    214   1.2     yamt 		/*
    215   1.2     yamt 		 * enforce the minimum thresholds on different
    216   1.2     yamt 		 * types of memory usage.  if reusing the current
    217   1.2     yamt 		 * page would reduce that type of usage below its
    218   1.2     yamt 		 * minimum, reactivate the page instead and move
    219   1.2     yamt 		 * on to the next page.
    220   1.2     yamt 		 */
    221   1.2     yamt 
    222   1.2     yamt 		if (uobj && UVM_OBJ_IS_VTEXT(uobj) && ss->ss_execreact) {
    223   1.2     yamt 			uvmpdpol_pageactivate(pg);
    224   1.2     yamt 			PDPOL_EVCNT_INCR(reactexec);
    225   1.2     yamt 			continue;
    226   1.2     yamt 		}
    227   1.2     yamt 		if (uobj && UVM_OBJ_IS_VNODE(uobj) &&
    228   1.2     yamt 		    !UVM_OBJ_IS_VTEXT(uobj) && ss->ss_filereact) {
    229   1.2     yamt 			uvmpdpol_pageactivate(pg);
    230   1.2     yamt 			PDPOL_EVCNT_INCR(reactfile);
    231   1.2     yamt 			continue;
    232   1.2     yamt 		}
    233   1.2     yamt 		if ((anon || UVM_OBJ_IS_AOBJ(uobj)) && ss->ss_anonreact) {
    234   1.2     yamt 			uvmpdpol_pageactivate(pg);
    235   1.2     yamt 			PDPOL_EVCNT_INCR(reactanon);
    236   1.2     yamt 			continue;
    237   1.2     yamt 		}
    238   1.2     yamt 
    239   1.2     yamt 		break;
    240   1.2     yamt 	}
    241   1.2     yamt 
    242   1.2     yamt 	return pg;
    243   1.2     yamt }
    244   1.2     yamt 
    245   1.2     yamt void
    246   1.2     yamt uvmpdpol_balancequeue(int swap_shortage)
    247   1.2     yamt {
    248   1.2     yamt 	int inactive_shortage;
    249   1.2     yamt 	struct vm_page *p, *nextpg;
    250   1.2     yamt 
    251   1.2     yamt 	/*
    252   1.2     yamt 	 * we have done the scan to get free pages.   now we work on meeting
    253   1.2     yamt 	 * our inactive target.
    254   1.2     yamt 	 */
    255   1.2     yamt 
    256   1.2     yamt 	inactive_shortage = pdpol_state.s_inactarg - pdpol_state.s_inactive;
    257   1.2     yamt 	for (p = TAILQ_FIRST(&pdpol_state.s_activeq);
    258   1.2     yamt 	     p != NULL && (inactive_shortage > 0 || swap_shortage > 0);
    259   1.2     yamt 	     p = nextpg) {
    260  1.12       ad 		nextpg = TAILQ_NEXT(p, pageq.queue);
    261   1.2     yamt 
    262   1.2     yamt 		/*
    263   1.2     yamt 		 * if there's a shortage of swap slots, try to free it.
    264   1.2     yamt 		 */
    265   1.2     yamt 
    266   1.2     yamt 		if (swap_shortage > 0 && (p->pqflags & PQ_SWAPBACKED) != 0) {
    267   1.2     yamt 			if (uvmpd_trydropswap(p)) {
    268   1.2     yamt 				swap_shortage--;
    269   1.2     yamt 			}
    270   1.2     yamt 		}
    271   1.2     yamt 
    272   1.2     yamt 		/*
    273   1.2     yamt 		 * if there's a shortage of inactive pages, deactivate.
    274   1.2     yamt 		 */
    275   1.2     yamt 
    276   1.2     yamt 		if (inactive_shortage > 0) {
    277   1.2     yamt 			/* no need to check wire_count as pg is "active" */
    278   1.2     yamt 			uvmpdpol_pagedeactivate(p);
    279   1.2     yamt 			uvmexp.pddeact++;
    280   1.2     yamt 			inactive_shortage--;
    281   1.2     yamt 		}
    282   1.2     yamt 	}
    283   1.2     yamt }
    284   1.2     yamt 
    285   1.2     yamt void
    286   1.2     yamt uvmpdpol_pagedeactivate(struct vm_page *pg)
    287   1.2     yamt {
    288   1.2     yamt 
    289   1.9       ad 	KASSERT(mutex_owned(&uvm_pageqlock));
    290   1.2     yamt 	if (pg->pqflags & PQ_ACTIVE) {
    291  1.12       ad 		TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pageq.queue);
    292   1.2     yamt 		pg->pqflags &= ~PQ_ACTIVE;
    293   1.2     yamt 		KASSERT(pdpol_state.s_active > 0);
    294   1.2     yamt 		pdpol_state.s_active--;
    295   1.2     yamt 	}
    296   1.2     yamt 	if ((pg->pqflags & PQ_INACTIVE) == 0) {
    297   1.2     yamt 		KASSERT(pg->wire_count == 0);
    298  1.10     yamt 		pmap_clear_reference(pg);
    299  1.12       ad 		TAILQ_INSERT_TAIL(&pdpol_state.s_inactiveq, pg, pageq.queue);
    300   1.2     yamt 		pg->pqflags |= PQ_INACTIVE;
    301   1.2     yamt 		pdpol_state.s_inactive++;
    302   1.2     yamt 	}
    303   1.2     yamt }
    304   1.2     yamt 
    305   1.2     yamt void
    306   1.2     yamt uvmpdpol_pageactivate(struct vm_page *pg)
    307   1.2     yamt {
    308   1.2     yamt 
    309   1.2     yamt 	uvmpdpol_pagedequeue(pg);
    310  1.12       ad 	TAILQ_INSERT_TAIL(&pdpol_state.s_activeq, pg, pageq.queue);
    311   1.2     yamt 	pg->pqflags |= PQ_ACTIVE;
    312   1.2     yamt 	pdpol_state.s_active++;
    313   1.2     yamt }
    314   1.2     yamt 
    315   1.2     yamt void
    316   1.2     yamt uvmpdpol_pagedequeue(struct vm_page *pg)
    317   1.2     yamt {
    318   1.2     yamt 
    319   1.2     yamt 	if (pg->pqflags & PQ_ACTIVE) {
    320   1.9       ad 		KASSERT(mutex_owned(&uvm_pageqlock));
    321  1.12       ad 		TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pageq.queue);
    322   1.2     yamt 		pg->pqflags &= ~PQ_ACTIVE;
    323   1.2     yamt 		KASSERT(pdpol_state.s_active > 0);
    324   1.2     yamt 		pdpol_state.s_active--;
    325   1.2     yamt 	} else if (pg->pqflags & PQ_INACTIVE) {
    326   1.9       ad 		KASSERT(mutex_owned(&uvm_pageqlock));
    327  1.12       ad 		TAILQ_REMOVE(&pdpol_state.s_inactiveq, pg, pageq.queue);
    328   1.2     yamt 		pg->pqflags &= ~PQ_INACTIVE;
    329   1.2     yamt 		KASSERT(pdpol_state.s_inactive > 0);
    330   1.2     yamt 		pdpol_state.s_inactive--;
    331   1.2     yamt 	}
    332   1.2     yamt }
    333   1.2     yamt 
    334   1.2     yamt void
    335   1.2     yamt uvmpdpol_pageenqueue(struct vm_page *pg)
    336   1.2     yamt {
    337   1.2     yamt 
    338   1.2     yamt 	uvmpdpol_pageactivate(pg);
    339   1.2     yamt }
    340   1.2     yamt 
    341   1.2     yamt void
    342   1.5     yamt uvmpdpol_anfree(struct vm_anon *an)
    343   1.2     yamt {
    344   1.2     yamt }
    345   1.2     yamt 
    346   1.7  thorpej bool
    347   1.2     yamt uvmpdpol_pageisqueued_p(struct vm_page *pg)
    348   1.2     yamt {
    349   1.2     yamt 
    350   1.2     yamt 	return (pg->pqflags & (PQ_ACTIVE | PQ_INACTIVE)) != 0;
    351   1.2     yamt }
    352   1.2     yamt 
    353   1.2     yamt void
    354   1.2     yamt uvmpdpol_estimatepageable(int *active, int *inactive)
    355   1.2     yamt {
    356   1.2     yamt 
    357   1.2     yamt 	if (active) {
    358   1.2     yamt 		*active = pdpol_state.s_active;
    359   1.2     yamt 	}
    360   1.2     yamt 	if (inactive) {
    361   1.2     yamt 		*inactive = pdpol_state.s_inactive;
    362   1.2     yamt 	}
    363   1.2     yamt }
    364   1.2     yamt 
    365   1.2     yamt #if !defined(PDSIM)
    366   1.2     yamt static int
    367   1.2     yamt min_check(struct uvm_pctparam *pct, int t)
    368   1.2     yamt {
    369   1.2     yamt 	struct uvmpdpol_globalstate *s = &pdpol_state;
    370   1.2     yamt 	int total = t;
    371   1.2     yamt 
    372   1.2     yamt 	if (pct != &s->s_anonmin) {
    373   1.2     yamt 		total += uvm_pctparam_get(&s->s_anonmin);
    374   1.2     yamt 	}
    375   1.2     yamt 	if (pct != &s->s_filemin) {
    376   1.2     yamt 		total += uvm_pctparam_get(&s->s_filemin);
    377   1.2     yamt 	}
    378   1.2     yamt 	if (pct != &s->s_execmin) {
    379   1.2     yamt 		total += uvm_pctparam_get(&s->s_execmin);
    380   1.2     yamt 	}
    381   1.2     yamt 	if (total > 95) {
    382   1.2     yamt 		return EINVAL;
    383   1.2     yamt 	}
    384   1.2     yamt 	return 0;
    385   1.2     yamt }
    386   1.2     yamt #endif /* !defined(PDSIM) */
    387   1.2     yamt 
    388   1.2     yamt void
    389   1.2     yamt uvmpdpol_init(void)
    390   1.2     yamt {
    391   1.2     yamt 	struct uvmpdpol_globalstate *s = &pdpol_state;
    392   1.2     yamt 
    393   1.2     yamt 	TAILQ_INIT(&s->s_activeq);
    394   1.2     yamt 	TAILQ_INIT(&s->s_inactiveq);
    395   1.2     yamt 	uvm_pctparam_init(&s->s_inactivepct, CLOCK_INACTIVEPCT, NULL);
    396   1.2     yamt 	uvm_pctparam_init(&s->s_anonmin, 10, min_check);
    397   1.2     yamt 	uvm_pctparam_init(&s->s_filemin, 10, min_check);
    398   1.2     yamt 	uvm_pctparam_init(&s->s_execmin,  5, min_check);
    399   1.2     yamt 	uvm_pctparam_init(&s->s_anonmax, 80, NULL);
    400   1.2     yamt 	uvm_pctparam_init(&s->s_filemax, 50, NULL);
    401   1.2     yamt 	uvm_pctparam_init(&s->s_execmax, 30, NULL);
    402   1.2     yamt }
    403   1.2     yamt 
    404   1.2     yamt void
    405   1.2     yamt uvmpdpol_reinit(void)
    406   1.2     yamt {
    407   1.2     yamt }
    408   1.2     yamt 
    409   1.7  thorpej bool
    410   1.2     yamt uvmpdpol_needsscan_p(void)
    411   1.2     yamt {
    412   1.2     yamt 
    413   1.2     yamt 	return pdpol_state.s_inactive < pdpol_state.s_inactarg;
    414   1.2     yamt }
    415   1.2     yamt 
    416   1.2     yamt void
    417   1.2     yamt uvmpdpol_tune(void)
    418   1.2     yamt {
    419   1.2     yamt 
    420   1.2     yamt 	clock_tune();
    421   1.2     yamt }
    422   1.2     yamt 
    423   1.2     yamt #if !defined(PDSIM)
    424   1.2     yamt 
    425   1.2     yamt #include <sys/sysctl.h>	/* XXX SYSCTL_DESCR */
    426   1.2     yamt 
    427   1.2     yamt void
    428   1.2     yamt uvmpdpol_sysctlsetup(void)
    429   1.2     yamt {
    430   1.2     yamt 	struct uvmpdpol_globalstate *s = &pdpol_state;
    431   1.2     yamt 
    432   1.2     yamt 	uvm_pctparam_createsysctlnode(&s->s_anonmin, "anonmin",
    433   1.2     yamt 	    SYSCTL_DESCR("Percentage of physical memory reserved "
    434   1.2     yamt 	    "for anonymous application data"));
    435   1.2     yamt 	uvm_pctparam_createsysctlnode(&s->s_filemin, "filemin",
    436   1.2     yamt 	    SYSCTL_DESCR("Percentage of physical memory reserved "
    437  1.11   martin 	    "for cached file data"));
    438   1.2     yamt 	uvm_pctparam_createsysctlnode(&s->s_execmin, "execmin",
    439   1.2     yamt 	    SYSCTL_DESCR("Percentage of physical memory reserved "
    440  1.11   martin 	    "for cached executable data"));
    441   1.2     yamt 
    442   1.2     yamt 	uvm_pctparam_createsysctlnode(&s->s_anonmax, "anonmax",
    443   1.2     yamt 	    SYSCTL_DESCR("Percentage of physical memory which will "
    444   1.2     yamt 	    "be reclaimed from other usage for "
    445   1.2     yamt 	    "anonymous application data"));
    446   1.2     yamt 	uvm_pctparam_createsysctlnode(&s->s_filemax, "filemax",
    447   1.2     yamt 	    SYSCTL_DESCR("Percentage of physical memory which will "
    448   1.2     yamt 	    "be reclaimed from other usage for cached "
    449   1.2     yamt 	    "file data"));
    450   1.2     yamt 	uvm_pctparam_createsysctlnode(&s->s_execmax, "execmax",
    451   1.2     yamt 	    SYSCTL_DESCR("Percentage of physical memory which will "
    452   1.2     yamt 	    "be reclaimed from other usage for cached "
    453   1.2     yamt 	    "executable data"));
    454   1.2     yamt 
    455   1.2     yamt 	uvm_pctparam_createsysctlnode(&s->s_inactivepct, "inactivepct",
    456   1.2     yamt 	    SYSCTL_DESCR("Percentage of inactive queue of "
    457   1.2     yamt 	    "the entire (active + inactive) queue"));
    458   1.2     yamt }
    459   1.2     yamt 
    460   1.2     yamt #endif /* !defined(PDSIM) */
    461   1.2     yamt 
    462   1.2     yamt #if defined(PDSIM)
    463   1.2     yamt void
    464   1.2     yamt pdsim_dump(const char *id)
    465   1.2     yamt {
    466   1.2     yamt #if defined(DEBUG)
    467   1.2     yamt 	/* XXX */
    468   1.2     yamt #endif /* defined(DEBUG) */
    469   1.2     yamt }
    470   1.2     yamt #endif /* defined(PDSIM) */
    471