turn vm.loanread sysctl to a threshold. yamt-pagecache
authoryamt <yamt@NetBSD.org>
Sun, 05 Feb 2012 04:58:29 +0000
branchyamt-pagecache
changeset 280354 b990930474f5
parent 280353 f580e8930184
child 280355 4e5e9063fc5c
turn vm.loanread sysctl to a threshold.
sys/uvm/uvm_extern.h
sys/uvm/uvm_loan.c
sys/uvm/uvm_meter.c
--- a/sys/uvm/uvm_extern.h	Wed Jan 25 00:41:36 2012 +0000
+++ b/sys/uvm/uvm_extern.h	Sun Feb 05 04:58:29 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.176.2.7 2012/01/11 00:08:40 yamt Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.176.2.8 2012/02/05 04:58:29 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -505,7 +505,7 @@
 /* MD code needs this without including <uvm/uvm.h> */
 extern bool vm_page_zero_enable;
 
-extern bool vm_loan_read;
+extern int vm_loan_read_thresh;
 #endif
 
 /*
--- a/sys/uvm/uvm_loan.c	Wed Jan 25 00:41:36 2012 +0000
+++ b/sys/uvm/uvm_loan.c	Sun Feb 05 04:58:29 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_loan.c,v 1.81.2.13 2012/01/25 00:41:36 yamt Exp $	*/
+/*	$NetBSD: uvm_loan.c,v 1.81.2.14 2012/02/05 04:58:29 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.81.2.13 2012/01/25 00:41:36 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.81.2.14 2012/02/05 04:58:29 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -42,7 +42,7 @@
 
 #include <uvm/uvm.h>
 
-bool vm_loan_read = true;
+int vm_loan_read_thresh = MAXPHYS;
 
 /*
  * "loaned" pages are pages which are (read-only, copy-on-write) loaned
@@ -1304,7 +1304,7 @@
 	size_t len;
 	int i, error = 0;
 
-	if (!vm_loan_read) {
+	if (vm_loan_read_thresh > 0 && uio->uio_resid < vm_loan_read_thresh) {
 		return ENOSYS;
 	}
 
--- a/sys/uvm/uvm_meter.c	Wed Jan 25 00:41:36 2012 +0000
+++ b/sys/uvm/uvm_meter.c	Sun Feb 05 04:58:29 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_meter.c,v 1.56.4.7 2012/01/11 00:08:41 yamt Exp $	*/
+/*	$NetBSD: uvm_meter.c,v 1.56.4.8 2012/02/05 04:58:29 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_meter.c,v 1.56.4.7 2012/01/11 00:08:41 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_meter.c,v 1.56.4.8 2012/02/05 04:58:29 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -324,9 +324,10 @@
 		       CTL_VM, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-		       CTLTYPE_BOOL, "loanread",
-		       SYSCTL_DESCR("Use page loaning for read"),
-		       NULL, 0, &vm_loan_read, 0,
+		       CTLTYPE_INT, "loan_read_thresh",
+		       SYSCTL_DESCR(
+			   "Threshold in bytes to use page loaning for read"),
+		       NULL, 0, &vm_loan_read_thresh, 0,
 		       CTL_VM, CTL_CREATE, CTL_EOL);
 
 	uvmpdpol_sysctlsetup();