Merge uma.h:1.27, uma_core.c:1.129 from HEAD to RELENG_6:

Rename UMA_MAX_NAME to UTH_MAX_NAME, since it's a maximum in the
  monitoring API, which might or might not be the same as the internal
  maximum (currently none).

  Export flag information on UMA zones -- in particular, whether or
  not this is a secondary zone, and so the keg free count should be
  considered in that light.

Approved by:	re (kensmith)
This commit is contained in:
rwatson 2005-07-28 12:10:19 +00:00
parent 0775c0fa95
commit b90366a3fc
2 changed files with 14 additions and 5 deletions

View File

@ -522,12 +522,13 @@ struct uma_stream_header {
u_int32_t _ush_pad; /* Pad/reserved field. */
};
#define UMA_MAX_NAME 32
#define UTH_MAX_NAME 32
#define UTH_ZONE_SECONDARY 0x00000001
struct uma_type_header {
/*
* Static per-zone data, some extracted from the supporting keg.
*/
char uth_name[UMA_MAX_NAME];
char uth_name[UTH_MAX_NAME];
u_int32_t uth_align; /* Keg: alignment. */
u_int32_t uth_size; /* Keg: requested size of item. */
u_int32_t uth_rsize; /* Keg: real size of item. */
@ -541,12 +542,11 @@ struct uma_type_header {
u_int32_t uth_keg_free; /* Keg: items free. */
u_int32_t uth_zone_free; /* Zone: items free. */
u_int32_t uth_bucketsize; /* Zone: desired bucket size. */
u_int32_t _uth_reserved0; /* Reserved. */
u_int32_t uth_zone_flags; /* Zone: flags. */
u_int64_t uth_allocs; /* Zone: number of allocations. */
u_int64_t uth_frees; /* Zone: number of frees. */
u_int64_t uth_fails; /* Zone: number of alloc failures. */
u_int64_t _uth_reserved1[3]; /* Reserved. */
};
struct uma_percpu_stat {

View File

@ -2980,7 +2980,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS)
LIST_FOREACH(z, &kz->uk_zones, uz_link) {
bzero(&uth, sizeof(uth));
ZONE_LOCK(z);
strlcpy(uth.uth_name, z->uz_name, UMA_MAX_NAME);
strlcpy(uth.uth_name, z->uz_name, UTH_MAX_NAME);
uth.uth_align = kz->uk_align;
uth.uth_pages = kz->uk_pages;
uth.uth_keg_free = kz->uk_free;
@ -2993,6 +2993,15 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS)
else
uth.uth_limit = kz->uk_maxpages *
kz->uk_ipers;
/*
* A zone is secondary is it is not the first entry
* on the keg's zone list.
*/
if ((kz->uk_flags & UMA_ZONE_SECONDARY) &&
(LIST_FIRST(&kz->uk_zones) != z))
uth.uth_zone_flags = UTH_ZONE_SECONDARY;
LIST_FOREACH(bucket, &z->uz_full_bucket, ub_link)
uth.uth_zone_free += bucket->ub_cnt;
uth.uth_allocs = z->uz_allocs;