kern/114654: [patch] make vm_page_max_wired tunnable at run time

Eugene Grosbein eugen at
Tue Jul 17 11:50:04 UTC 2007

>Number:         114654
>Category:       kern
>Synopsis:       [patch] make vm_page_max_wired tunnable at run time
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 17 11:50:02 GMT 2007
>Originator:     Eugene Grosbein
>Release:        FreeBSD 6.2-STABLE i386
Svyaz-Service JSC
System: FreeBSD 6.2-STABLE FreeBSD 6.2-STABLE #0: Tue Jul 17 19:23:09 KRAST 2007 eu at i386

	The kernel limits number of pages mlock()'ed by a process
	to one third of vm.stats.vm.v_free_count to prevent damage
	from broken processes. However, sometimes there is a need to allow
	a process to mlock() more than half of free pages pool,
	one example is /usr/ports/sysutils/memtest.
	Let's make vm_page_max_wired tunnable at run time.

	I've installed second 1Gb memory module to my system and
	want to quick-check (most part of) it. I've raised kern.maxdsize
	but the kernel still does not allow memtest to mlock() so many pages.

	Yes, I know the best method is to boot the system from floppy
	of CD with special memory tester. But I'd glad to see this
	way allowed too.

	Running kernel with the following patch, I may increase
	sysctl vm.max_wired value upto, say, 1.5Gb
	for the system having 2Gb RAM and still run memtest from's
	xterm session (top shows "1802M Free" here).

--- sys/vm/vm_pageout.c.orig	Tue Jul 17 19:18:56 2007
+++ sys/vm/vm_pageout.c	Tue Jul 17 19:33:52 2007
@@ -203,6 +203,8 @@
 int vm_pageout_page_count = VM_PAGEOUT_PAGE_COUNT;
 int vm_page_max_wired;		/* XXX max # of wired pages system-wide */
+SYSCTL_INT(_vm, OID_AUTO, max_wired,
+	CTLFLAG_RW, &vm_page_max_wired, 0, "System-wide limit to wired page count");
 #if !defined(NO_SWAPPING)
 static void vm_pageout_map_deactivate_pages(vm_map_t, long);

Eugene Grosbein

More information about the freebsd-bugs mailing list