Index: sys/kern/subr_pool.c =================================================================== RCS file: /cvsroot/src/sys/kern/subr_pool.c,v retrieving revision 1.249 diff -u -p -r1.249 subr_pool.c --- sys/kern/subr_pool.c 13 Apr 2019 08:41:36 -0000 1.249 +++ sys/kern/subr_pool.c 2 May 2019 15:45:14 -0000 @@ -1635,10 +1636,20 @@ pool_drain(struct pool **ppp) int pool_totalpages(void) { + + mutex_enter(&pool_head_lock); + int pages = pool_totalpages_locked(); + mutex_exit(&pool_head_lock); + + return pages; +} + +int +pool_totalpages_locked(void) +{ struct pool *pp; uint64_t total = 0; - mutex_enter(&pool_head_lock); TAILQ_FOREACH(pp, &pool_head, pr_poollist) { uint64_t bytes = pp->pr_npages * pp->pr_alloc->pa_pagesz; @@ -1646,7 +1657,6 @@ pool_totalpages(void) bytes -= (pp->pr_nout * pp->pr_size); total += bytes; } - mutex_exit(&pool_head_lock); return atop(total); } Index: sys/sys/pool.h =================================================================== RCS file: /cvsroot/src/sys/sys/pool.h,v retrieving revision 1.88 diff -u -p -r1.88 pool.h --- sys/sys/pool.h 13 Apr 2019 08:41:37 -0000 1.88 +++ sys/sys/pool.h 2 May 2019 15:45:17 -0000 @@ -320,6 +320,7 @@ void pool_sethiwat(struct pool *, int); void pool_sethardlimit(struct pool *, int, const char *, int); bool pool_drain(struct pool **); int pool_totalpages(void); +int pool_totalpages_locked(void); /* * Debugging and diagnostic aides. Index: sys/uvm/uvm_stat.c =================================================================== RCS file: /cvsroot/src/sys/uvm/uvm_stat.c,v retrieving revision 1.39 diff -u -p -r1.39 uvm_stat.c --- sys/uvm/uvm_stat.c 2 Dec 2017 08:15:43 -0000 1.39 +++ sys/uvm/uvm_stat.c 2 May 2019 15:45:17 -0000 @@ -61,7 +61,7 @@ uvmexp_print(void (*pr)(const char *, .. struct cpu_info *ci; uvm_estimatepageable(&active, &inactive); - poolpages = pool_totalpages(); + poolpages = pool_totalpages_locked(); (*pr)("Current UVM status:\n"); (*pr)(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d, ncolors=%d\n",