summaryrefslogtreecommitdiffstats
path: root/sys/vm/uma_core.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-07-16 11:03:06 +0000
committerrwatson <rwatson@FreeBSD.org>2005-07-16 11:03:06 +0000
commit37cd630e38c7203b0118ad1a0bdd7880b9ec945c (patch)
tree351934160f1c337d6521e02b2e05aecc4ad8d28d /sys/vm/uma_core.c
parent4ead3022dd4e5764112c3777a52e2835310fcf7b (diff)
downloadFreeBSD-src-37cd630e38c7203b0118ad1a0bdd7880b9ec945c.zip
FreeBSD-src-37cd630e38c7203b0118ad1a0bdd7880b9ec945c.tar.gz
Use mp_maxid in preference to MAXCPU when creating exports of UMA
per-CPU cache statistics. UMA sizes the cache array based on the number of CPUs at boot (mp_maxid + 1), and iterating based on MAXCPU could read off the end of the array (into the next zone). Reported by: yongari MFC after: 1 week
Diffstat (limited to 'sys/vm/uma_core.c')
-rw-r--r--sys/vm/uma_core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index a116321..77da622 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -2933,7 +2933,7 @@ restart:
mtx_unlock(&uma_mtx);
buflen = sizeof(ush) + count * (sizeof(uth) + sizeof(ups) *
- MAXCPU) + 1;
+ (mp_maxid + 1)) + 1;
buffer = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
mtx_lock(&uma_mtx);
@@ -2955,7 +2955,7 @@ restart:
*/
bzero(&ush, sizeof(ush));
ush.ush_version = UMA_STREAM_VERSION;
- ush.ush_maxcpus = MAXCPU;
+ ush.ush_maxcpus = (mp_maxid + 1);
ush.ush_count = count;
if (sbuf_bcat(&sbuf, &ush, sizeof(ush)) < 0) {
mtx_unlock(&uma_mtx);
@@ -2999,7 +2999,7 @@ restart:
* accept the possible race associated with bucket
* exchange during monitoring.
*/
- for (i = 0; i < MAXCPU; i++) {
+ for (i = 0; i < (mp_maxid + 1); i++) {
bzero(&ups, sizeof(ups));
if (kz->uk_flags & UMA_ZFLAG_INTERNAL)
goto skip;
OpenPOWER on IntegriCloud