Date: Mon, 9 Nov 2020 22:58:29 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367532 - in head/sys: kern sys Message-ID: <202011092258.0A9MwTP4010174@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Mon Nov 9 22:58:29 2020 New Revision: 367532 URL: https://svnweb.freebsd.org/changeset/base/367532 Log: malloc: retire mt_stats_zone in favor of pcpu_zone_64 Reviewed by: markj, imp Differential Revision: https://reviews.freebsd.org/D27142 Modified: head/sys/kern/kern_malloc.c head/sys/sys/malloc.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Mon Nov 9 22:23:25 2020 (r367531) +++ head/sys/kern/kern_malloc.c Mon Nov 9 22:58:29 2020 (r367532) @@ -174,11 +174,6 @@ struct { {0, NULL}, }; -/* - * Zone to allocate per-CPU storage for statistics. - */ -static uma_zone_t mt_stats_zone; - u_long vm_kmem_size; SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, &vm_kmem_size, 0, "Size of kernel memory"); @@ -1184,9 +1179,6 @@ mallocinit(void *dummy) if (kmem_zmax < PAGE_SIZE || kmem_zmax > KMEM_ZMAX) kmem_zmax = KMEM_ZMAX; - mt_stats_zone = uma_zcreate("mt_stats_zone", - sizeof(struct malloc_type_stats), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_PCPU); for (i = 0, indx = 0; kmemzones[indx].kz_size != 0; indx++) { int size = kmemzones[indx].kz_size; const char *name = kmemzones[indx].kz_name; @@ -1222,7 +1214,7 @@ malloc_init(void *data) mtp->ks_shortdesc, mtp->ks_version); mtip = &mtp->ks_mti; - mtip->mti_stats = uma_zalloc_pcpu(mt_stats_zone, M_WAITOK | M_ZERO); + mtip->mti_stats = uma_zalloc_pcpu(pcpu_zone_64, M_WAITOK | M_ZERO); mtp_set_subzone(mtp); mtx_lock(&malloc_mtx); @@ -1279,7 +1271,7 @@ malloc_uninit(void *data) temp_allocs, temp_bytes); } - uma_zfree_pcpu(mt_stats_zone, mtip->mti_stats); + uma_zfree_pcpu(pcpu_zone_64, mtip->mti_stats); } struct malloc_type * Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Mon Nov 9 22:23:25 2020 (r367531) +++ head/sys/sys/malloc.h Mon Nov 9 22:58:29 2020 (r367532) @@ -92,6 +92,9 @@ struct malloc_type_stats { uint64_t _mts_reserved3; /* Reserved field. */ }; +_Static_assert(sizeof(struct malloc_type_stats) == 64, + "allocations come from pcpu_zone_64"); + /* * Index definitions for the mti_probes[] array. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011092258.0A9MwTP4010174>