Author: markj
Date: Thu Sep 17 16:49:28 2020
New Revision: 365841
URL: https://svnweb.freebsd.org/changeset/base/365841

Log:
  Increase the default vm.max_user_wired value.
  
  Since r347532 (merged to stable/12) we only count user-wired pages
  towards the system limit.  However, we now also treat pages wired by
  hypervisors (bhyve and virtualbox) as user-wired, so starting VMs with
  large amounts of RAM tends to fail due to the low limit.
  
  The purpose of the limit is to provide a seatbelt, not to impose some
  policy on the use of wired memory.  Thus, increase the default limit to
  allow reasonable VM configurations to work without tuning.
  
  Reviewed by:  kib
  Discussed with:       dougm
  MFC after:    3 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D26424

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c    Thu Sep 17 16:44:12 2020        (r365840)
+++ head/sys/vm/vm_pageout.c    Thu Sep 17 16:49:28 2020        (r365841)
@@ -2295,7 +2295,7 @@ vm_pageout_init_domain(int domain)
 static void
 vm_pageout_init(void)
 {
-       u_int freecount;
+       u_long freecount;
        int i;
 
        /*
@@ -2328,8 +2328,13 @@ vm_pageout_init(void)
        if (vm_pageout_update_period == 0)
                vm_pageout_update_period = 600;
 
+       /*
+        * Set the maximum number of user-wired virtual pages.  Historically the
+        * main source of such pages was mlock(2) and mlockall(2).  Hypervisors
+        * may also request user-wired memory.
+        */
        if (vm_page_max_user_wired == 0)
-               vm_page_max_user_wired = freecount / 3;
+               vm_page_max_user_wired = 4 * freecount / 5;
 }
 
 /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to