Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
Re: less confusing line in vmstat -s output
To:
Miod Vallat <miod@online.fr>
Cc:
tech@openbsd.org
Date:
Fri, 7 Mar 2025 17:48:01 +0100

Download raw body.

Thread
On Fri, Mar 07, 2025 at 03:40:29PM +0000, Miod Vallat wrote:
> A long, long time ago, in a CSRG far away, the page daemon, a system
> process responsible for handling swap, was running on a fixed frequency.
> Then, good ideas from the Mach VM were borrowed, and it was changed to
> run "when there are good reasons to trigger it".
> 
> But the documentation of the counter of invocations/wakeups of that
> daemon was left unchanged.
> 
> Which is why vmstat -s reports it as the number of "revolutions of the
> clock hand", which someone might believe is something time-related, but
> is nowadays completely different.
> 
> The following diff tries to put a bit more sense in this.

Thanks, ok

> Index: sys/uvm/uvmexp.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/uvm/uvmexp.h,v
> diff -u -p -r1.17 uvmexp.h
> --- sys/uvm/uvmexp.h	25 Feb 2025 11:29:17 -0000	1.17
> +++ sys/uvm/uvmexp.h	7 Mar 2025 15:33:56 -0000
> @@ -139,7 +139,7 @@ struct uvmexp {
>  
>  	/* daemon counters */
>  	int pdwoke;	/* [F] # of times daemon woke up */
> -	int pdrevs;	/* number of times daemon rev'd clock hand */
> +	int pdrevs;	/* number of times daemon called for free pages */
>  	int pdswout;	/* number of times daemon called for swapout */
>  	int pdfreed;	/* number of pages daemon freed since boot */
>  	int pdscans;	/* number of pages daemon scanned since boot */
> Index: usr.bin/vmstat/vmstat.c
> ===================================================================
> RCS file: /OpenBSD/src/usr.bin/vmstat/vmstat.c,v
> diff -u -p -r1.158 vmstat.c
> --- usr.bin/vmstat/vmstat.c	1 May 2024 12:54:27 -0000	1.158
> +++ usr.bin/vmstat/vmstat.c	7 Mar 2025 15:33:56 -0000
> @@ -542,7 +542,7 @@ dosum(void)
>  	/* daemon counters */
>  	(void)printf("%11u number of times the pagedaemon woke up\n",
>  		     uvmexp.pdwoke);
> -	(void)printf("%11u revolutions of the clock hand\n", uvmexp.pdrevs);
> +	(void)printf("%11u number of times the pagedaemon scanned for free pages\n", uvmexp.pdrevs);
>  	(void)printf("%11u pages freed by pagedaemon\n", uvmexp.pdfreed);
>  	(void)printf("%11u pages scanned by pagedaemon\n", uvmexp.pdscans);
>  	(void)printf("%11u pages reactivated by pagedaemon\n", uvmexp.pdreact);
> 

-- 
jca