From 2a6f03d90f6061ad7ffefc8e5be51a91a384b83c Mon Sep 17 00:00:00 2001 From: anton Date: Wed, 15 May 2019 06:12:20 +0000 Subject: free size for amap; ok visa@ --- sys/uvm/uvm_amap.c | 6 ++++-- sys/uvm/uvm_amap.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c index 5cf15f24317..b0f9aa85920 100644 --- a/sys/uvm/uvm_amap.c +++ b/sys/uvm/uvm_amap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_amap.c,v 1.79 2017/01/31 17:08:51 dhill Exp $ */ +/* $OpenBSD: uvm_amap.c,v 1.80 2019/05/15 06:12:19 anton Exp $ */ /* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */ /* @@ -342,6 +342,7 @@ amap_alloc1(int slots, int waitf, int lazyalloc) M_UVMAMAP, waitf | (lazyalloc ? M_ZERO : 0)); if (amap->am_buckets == NULL) goto fail1; + amap->am_nbuckets = buckets; if (!lazyalloc) { for (i = 0; i < buckets; i++) { @@ -422,7 +423,8 @@ amap_free(struct vm_amap *amap) else { TAILQ_FOREACH_SAFE(chunk, &amap->am_chunks, ac_list, tmp) pool_put(&uvm_amap_chunk_pool, chunk); - free(amap->am_buckets, M_UVMAMAP, 0); + free(amap->am_buckets, M_UVMAMAP, + amap->am_nbuckets * sizeof(*amap->am_buckets)); pool_put(&uvm_amap_pool, amap); } } diff --git a/sys/uvm/uvm_amap.h b/sys/uvm/uvm_amap.h index 1b6e276cd3e..f34cf7afe1b 100644 --- a/sys/uvm/uvm_amap.h +++ b/sys/uvm/uvm_amap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_amap.h,v 1.30 2017/02/05 01:11:50 guenther Exp $ */ +/* $OpenBSD: uvm_amap.h,v 1.31 2019/05/15 06:12:19 anton Exp $ */ /* $NetBSD: uvm_amap.h,v 1.14 2001/02/18 21:19:08 chs Exp $ */ /* @@ -146,6 +146,7 @@ struct vm_amap { struct { struct vm_amap_chunk **amn_buckets; TAILQ_HEAD(, vm_amap_chunk) amn_chunks; + int amn_nbuckets; /* # of buckets */ int amn_ncused; /* # of chunkers currently in use */ int amn_hashshift; /* shift count to hash slot to bucket */ } ami_normal; @@ -159,6 +160,7 @@ struct vm_amap { #define am_buckets am_impl.ami_normal.amn_buckets #define am_chunks am_impl.ami_normal.amn_chunks +#define am_nbuckets am_impl.ami_normal.amn_nbuckets #define am_ncused am_impl.ami_normal.amn_ncused #define am_hashshift am_impl.ami_normal.amn_hashshift -- cgit v1.2.3