Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern properly account PR_RECURSIVE pools like vmstat does.



details:   https://anonhg.NetBSD.org/src/rev/aae161cd47a4
branches:  trunk
changeset: 357935:aae161cd47a4
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Dec 04 03:05:24 2017 +0000

description:
properly account PR_RECURSIVE pools like vmstat does.

diffstat:

 sys/kern/subr_pool.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (46 lines):

diff -r 0c9b66e5bde0 -r aae161cd47a4 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Sun Dec 03 23:48:03 2017 +0000
+++ b/sys/kern/subr_pool.c      Mon Dec 04 03:05:24 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.217 2017/12/02 08:15:42 mrg Exp $      */
+/*     $NetBSD: subr_pool.c,v 1.218 2017/12/04 03:05:24 mrg Exp $      */
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.217 2017/12/02 08:15:42 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.218 2017/12/04 03:05:24 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1459,18 +1459,19 @@
 pool_totalpages(void)
 {
        struct pool *pp;
-       int total = 0;
+       uint64_t total = 0;
 
        mutex_enter(&pool_head_lock);
-       TAILQ_FOREACH(pp, &pool_head, pr_poollist)
-               /*
-                * XXXMRG
-               if ((pp->pr_roflags & PR_RECURSIVE) == 0)
-                */
-                       total += pp->pr_npages;
+       TAILQ_FOREACH(pp, &pool_head, pr_poollist) {
+               uint64_t bytes = pp->pr_npages * pp->pr_alloc->pa_pagesz;
+
+               if ((pp->pr_roflags & PR_RECURSIVE) != 0)
+                       bytes -= (pp->pr_nout * pp->pr_size);
+               total += bytes;
+       }
        mutex_exit(&pool_head_lock);
 
-       return total;
+       return atop(total);
 }
 
 /*



Home | Main Index | Thread Index | Old Index