diff options
| author | martin <martin@NetBSD.org> | 2022-07-17 10:34:10 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2022-07-17 10:34:10 +0000 |
| commit | 1b4303e621f4ffd6f23d34f5cd97a181cdedc94e (patch) | |
| tree | 4b37823bae7a565734ef18490e56f3aaafc11e84 /sys/kern | |
| parent | 538f1ff0b7ea5faefc70aa7bfb9f6b2ffd85ed0d (diff) | |
Pull up following revision(s) (requested by simonb in ticket #1479):
sys/kern/subr_pool.c: revision 1.285
Use 64-bit math to calculate pool sizes. Fixes overflow errors for
pools larger than 4GB and gives the correct output for kernel pool pages
in "vmstat -s" output.
Diffstat (limited to 'sys/kern')
| -rw-r--r-- | sys/kern/subr_pool.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index bb720e7c352..7f499e6f41b 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $ */ +/* $NetBSD: subr_pool.c,v 1.252.2.4 2022/07/17 10:34:10 martin Exp $ */ /* * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018 @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.4 2022/07/17 10:34:10 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1678,10 +1678,11 @@ pool_totalpages_locked(void) uint64_t total = 0; TAILQ_FOREACH(pp, &pool_head, pr_poollist) { - uint64_t bytes = pp->pr_npages * pp->pr_alloc->pa_pagesz; + uint64_t bytes = + (uint64_t)pp->pr_npages * pp->pr_alloc->pa_pagesz; if ((pp->pr_roflags & PR_RECURSIVE) != 0) - bytes -= (pp->pr_nout * pp->pr_size); + bytes -= ((uint64_t)pp->pr_nout * pp->pr_size); total += bytes; } |
