Date: Mon, 2 May 2011 17:13:40 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r221332 - projects/largeSMP/lib/libmemstat Message-ID: <201105021713.p42HDe3H047018@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Mon May 2 17:13:40 2011 New Revision: 221332 URL: http://svn.freebsd.org/changeset/base/221332 Log: Remove the redefinition of MEMSTAT_MAXCPU and just use MAXCPU for that. Reviewed by: sbruno Modified: projects/largeSMP/lib/libmemstat/memstat.c projects/largeSMP/lib/libmemstat/memstat.h projects/largeSMP/lib/libmemstat/memstat_internal.h projects/largeSMP/lib/libmemstat/memstat_malloc.c projects/largeSMP/lib/libmemstat/memstat_uma.c Modified: projects/largeSMP/lib/libmemstat/memstat.c ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat.c Mon May 2 17:08:36 2011 (r221331) +++ projects/largeSMP/lib/libmemstat/memstat.c Mon May 2 17:13:40 2011 (r221332) @@ -193,7 +193,7 @@ _memstat_mt_reset_stats(struct memory_ty mtp->mt_zonefree = 0; mtp->mt_kegfree = 0; - for (i = 0; i < MEMSTAT_MAXCPU; i++) { + for (i = 0; i < MAXCPU; i++) { mtp->mt_percpu_alloc[i].mtp_memalloced = 0; mtp->mt_percpu_alloc[i].mtp_memfreed = 0; mtp->mt_percpu_alloc[i].mtp_numallocs = 0; Modified: projects/largeSMP/lib/libmemstat/memstat.h ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat.h Mon May 2 17:08:36 2011 (r221331) +++ projects/largeSMP/lib/libmemstat/memstat.h Mon May 2 17:13:40 2011 (r221332) @@ -29,13 +29,6 @@ #ifndef _MEMSTAT_H_ #define _MEMSTAT_H_ -#include <machine/param.h> - -/* - * Number of CPU slots in library-internal data structures. - */ -#define MEMSTAT_MAXCPU MAXCPU - /* * Amount of caller data to maintain for each caller data slot. Applications * must not request more than this number of caller save data, or risk Modified: projects/largeSMP/lib/libmemstat/memstat_internal.h ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat_internal.h Mon May 2 17:08:36 2011 (r221331) +++ projects/largeSMP/lib/libmemstat/memstat_internal.h Mon May 2 17:13:40 2011 (r221332) @@ -100,11 +100,11 @@ struct memory_type { uint64_t mtp_sizemask; /* Per-CPU mt_sizemask. */ void *mtp_caller_pointer[MEMSTAT_MAXCALLER]; uint64_t mtp_caller_uint64[MEMSTAT_MAXCALLER]; - } mt_percpu_alloc[MEMSTAT_MAXCPU]; + } mt_percpu_alloc[MAXCPU]; struct { uint64_t mtp_free; /* Per-CPU cache free items. */ - } mt_percpu_cache[MEMSTAT_MAXCPU]; + } mt_percpu_cache[MAXCPU]; LIST_ENTRY(memory_type) mt_list; /* List of types. */ }; Modified: projects/largeSMP/lib/libmemstat/memstat_malloc.c ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat_malloc.c Mon May 2 17:08:36 2011 (r221331) +++ projects/largeSMP/lib/libmemstat/memstat_malloc.c Mon May 2 17:13:40 2011 (r221332) @@ -96,7 +96,7 @@ retry: return (-1); } - if (maxcpus > MEMSTAT_MAXCPU) { + if (maxcpus > MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; return (-1); } @@ -160,7 +160,7 @@ retry: return (-1); } - if (mtshp->mtsh_maxcpus > MEMSTAT_MAXCPU) { + if (mtshp->mtsh_maxcpus > MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; free(buffer); return (-1); @@ -295,7 +295,7 @@ memstat_kvm_malloc(struct memory_type_li void *kmemstatistics; int hint_dontsearch, j, mp_maxcpus, ret; char name[MEMTYPE_MAXNAME]; - struct malloc_type_stats mts[MEMSTAT_MAXCPU], *mtsp; + struct malloc_type_stats mts[MAXCPU], *mtsp; struct malloc_type_internal *mtip; struct malloc_type type, *typep; kvm_t *kvm; @@ -322,7 +322,7 @@ memstat_kvm_malloc(struct memory_type_li return (-1); } - if (mp_maxcpus > MEMSTAT_MAXCPU) { + if (mp_maxcpus > MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; return (-1); } @@ -348,11 +348,6 @@ memstat_kvm_malloc(struct memory_type_li list->mtl_error = ret; return (-1); } - - /* - * Since our compile-time value for MAXCPU may differ from the - * kernel's, we populate our own array. - */ mtip = type.ks_handle; ret = kread(kvm, mtip->mti_stats, mts, mp_maxcpus * sizeof(struct malloc_type_stats), 0); Modified: projects/largeSMP/lib/libmemstat/memstat_uma.c ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat_uma.c Mon May 2 17:08:36 2011 (r221331) +++ projects/largeSMP/lib/libmemstat/memstat_uma.c Mon May 2 17:13:40 2011 (r221332) @@ -27,6 +27,7 @@ */ #include <sys/param.h> +#include <sys/cpuset.h> #include <sys/sysctl.h> #define LIBMEMSTAT /* Cause vm_page.h not to include opt_vmpage.h */ @@ -104,7 +105,7 @@ retry: return (-1); } - if (maxcpus > MEMSTAT_MAXCPU) { + if (maxcpus > MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; return (-1); } @@ -168,7 +169,7 @@ retry: return (-1); } - if (ushp->ush_maxcpus > MEMSTAT_MAXCPU) { + if (ushp->ush_maxcpus > MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; free(buffer); return (-1); @@ -313,7 +314,7 @@ memstat_kvm_uma(struct memory_type_list struct uma_keg *kzp, kz; int hint_dontsearch, i, mp_maxid, ret; char name[MEMTYPE_MAXNAME]; - __cpumask_t all_cpus; + cpuset_t all_cpus; kvm_t *kvm; kvm = (kvm_t *)kvm_handle; @@ -407,7 +408,7 @@ memstat_kvm_uma(struct memory_type_list if (kz.uk_flags & UMA_ZFLAG_INTERNAL) goto skip_percpu; for (i = 0; i < mp_maxid + 1; i++) { - if ((all_cpus & (1 << i)) == 0) + if (!CPU_ISSET(i, &all_cpus)) continue; ucp = &ucp_array[i]; mtp->mt_numallocs += ucp->uc_allocs;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105021713.p42HDe3H047018>