Add a sysctl to disable swapout of kernel stacks. Discussed on tech-kern@.

This commit is contained in:
ad 2007-06-15 18:28:39 +00:00
parent 71d19c248a
commit 6820f4664f
3 changed files with 16 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm.h,v 1.49 2007/02/21 23:48:16 thorpej Exp $ */
/* $NetBSD: uvm.h,v 1.50 2007/06/15 18:28:39 ad Exp $ */
/*
*
@ -115,10 +115,10 @@ struct uvm {
kcondvar_t scheduler_cv;
kmutex_t scheduler_mutex;
bool scheduler_kicked;
int swapout_enabled;
/* kernel object: to support anonymous pageable kernel memory */
struct uvm_object *kernel_object;
};
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_pdaemon.c,v 1.84 2007/02/22 06:05:01 thorpej Exp $ */
/* $NetBSD: uvm_pdaemon.c,v 1.85 2007/06/15 18:28:39 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.84 2007/02/22 06:05:01 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.85 2007/06/15 18:28:39 ad Exp $");
#include "opt_uvmhist.h"
#include "opt_readahead.h"
@ -865,7 +865,8 @@ uvmpd_scan(void)
* we need to unlock the page queues for this.
*/
if (uvmexp.free < uvmexp.freetarg && uvmexp.nswapdev != 0) {
if (uvmexp.free < uvmexp.freetarg && uvmexp.nswapdev != 0 &&
uvm.swapout_enabled) {
uvmexp.pdswout++;
UVMHIST_LOG(pdhist," free %d < target %d: swapout",
uvmexp.free, uvmexp.freetarg, 0, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_swap.c,v 1.124 2007/04/22 08:30:02 dsl Exp $ */
/* $NetBSD: uvm_swap.c,v 1.125 2007/06/15 18:28:40 ad Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Matthew R. Green
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.124 2007/04/22 08:30:02 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.125 2007/06/15 18:28:40 ad Exp $");
#include "fs_nfs.h"
#include "opt_uvmhist.h"
@ -59,6 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.124 2007/04/22 08:30:02 dsl Exp $");
#include <sys/syscallargs.h>
#include <sys/swap.h>
#include <sys/kauth.h>
#include <sys/sysctl.h>
#include <uvm/uvm.h>
@ -285,7 +286,14 @@ uvm_swap_init(void)
* done!
*/
uvm.swap_running = true;
uvm.swapout_enabled = 1;
UVMHIST_LOG(pdhist, "<- done", 0, 0, 0, 0);
sysctl_createv(NULL, 0, NULL, NULL,
CTLFLAG_READWRITE,
CTLTYPE_INT, "swapout",
SYSCTL_DESCR("Set 0 to disable swapout of kernel stacks"),
NULL, 0, &uvm.swapout_enabled, 0, CTL_VM, CTL_CREATE, CTL_EOL);
}
/*