Index | Thread | Search

From:
Martin Pieuchot <mpi@grenadille.net>
Subject:
Re: Page reserves
To:
Theo Buehler <tb@openbsd.org>
Cc:
tech@openbsd.org
Date:
Mon, 25 Nov 2024 19:47:06 +0100

Download raw body.

Thread
On 25/11/24(Mon) 19:32, Theo Buehler wrote:
> On Mon, Nov 25, 2024 at 02:44:05PM +0100, Martin Pieuchot wrote:
> > Diff below removes unused 'min' values and indicates that the reserve
> > for the kernel includes the one for the page daemon.
> > 
> > While here add a comment to document that reserving 'high' memory for
> > the page daemon is not helping.
> > 
> > No change in behavior.
> 
> I'm ok with the removal part of the diff, but you add SWCLUSTPAGES to
> uvmexp.reserve_pagedaemon and uvmexp.reserve_kernel:

Thanks.

> > -	uvmexp.reserve_pagedaemon = 4;
> > -	uvmexp.reserve_kernel = 8;
> ...
> > +	uvmexp.reserve_pagedaemon = SWCLUSTPAGES + 4;
> > +	uvmexp.reserve_kernel = uvmexp.reserve_pagedaemon + 4;
> 
> Is this intentional? And if so, how is it not a change in behavior?

It's not.  It's a mistake.  Diff below is the correct one.

Index: uvm/uvm_meter.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_meter.c,v
diff -u -p -r1.50 uvm_meter.c
--- uvm/uvm_meter.c	16 Sep 2023 09:33:27 -0000	1.50
+++ uvm/uvm_meter.c	9 Nov 2024 12:37:11 -0000
@@ -301,9 +301,6 @@ uvmexp_print(int (*pr)(const char *, ...
 	(*pr)("  %d VM pages: %d active, %d inactive, %d wired, %d free (%d zero)\n",
 	    uexp.npages, uexp.active, uexp.inactive, uexp.wired,
 	    uexp.free, uexp.zeropages);
-	(*pr)("  min  %d%% (%d) anon, %d%% (%d) vnode, %d%% (%d) vtext\n",
-	    uexp.anonminpct, uexp.anonmin, uexp.vnodeminpct,
-	    uexp.vnodemin, uexp.vtextminpct, uexp.vtextmin);
 	(*pr)("  freemin=%d, free-target=%d, inactive-target=%d, "
 	    "wired-max=%d\n", uexp.freemin, uexp.freetarg, uexp.inactarg,
 	    uexp.wiredmax);
Index: uvm/uvm_page.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_page.c,v
diff -u -p -r1.177 uvm_page.c
--- uvm/uvm_page.c	1 May 2024 12:54:27 -0000	1.177
+++ uvm/uvm_page.c	19 Nov 2024 08:26:44 -0000
@@ -279,17 +279,16 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr
 	mtx_init(&uvm.aiodoned_lock, IPL_BIO);
 
 	/*
-	 * init reserve thresholds
-	 * XXXCDC - values may need adjusting
+	 * init reserve thresholds.
+	 *
+	 * XXX As long as some disk drivers cannot write any physical
+	 * XXX page, we need DMA reachable reserves for the pagedaemon.
+	 * XXX We cannot enforce such requirement but it should be ok
+	 * XXX in most of the cases because the pmemrange tries hard to
+	 * XXX allocate them last.
 	 */
 	uvmexp.reserve_pagedaemon = 4;
-	uvmexp.reserve_kernel = 8;
-	uvmexp.anonminpct = 10;
-	uvmexp.vnodeminpct = 10;
-	uvmexp.vtextminpct = 5;
-	uvmexp.anonmin = uvmexp.anonminpct * 256 / 100;
-	uvmexp.vnodemin = uvmexp.vnodeminpct * 256 / 100;
-	uvmexp.vtextmin = uvmexp.vtextminpct * 256 / 100;
+	uvmexp.reserve_kernel = uvmexp.reserve_pagedaemon + 4;
 
 	uvm.page_init_done = TRUE;
 }