uma: pretty print zone flags sysctl
Requested by: jeff Reviewed by: jeff, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22748
This commit is contained in:
parent
a9365f4a17
commit
6d204a6a0e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355605
@ -289,6 +289,7 @@ static int sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_handle_uma_zone_allocs(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_handle_uma_zone_frees(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
#ifdef INVARIANTS
|
||||
static bool uma_dbg_kskip(uma_keg_t keg, void *mem);
|
||||
@ -1896,8 +1897,9 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused)
|
||||
oid = zone->uz_oid;
|
||||
SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
|
||||
"size", CTLFLAG_RD, &zone->uz_size, 0, "Allocation size");
|
||||
SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
|
||||
"flags", CTLFLAG_RD, &zone->uz_flags, 0,
|
||||
SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
|
||||
"flags", CTLFLAG_RD | CTLTYPE_STRING | CTLFLAG_MPSAFE,
|
||||
zone, 0, sysctl_handle_uma_zone_flags, "A",
|
||||
"Allocator configuration flags");
|
||||
SYSCTL_ADD_U16(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
|
||||
"bucket_size", CTLFLAG_RD, &zone->uz_bucket_size, 0,
|
||||
@ -4408,6 +4410,24 @@ sysctl_handle_uma_zone_frees(SYSCTL_HANDLER_ARGS)
|
||||
return (sysctl_handle_64(oidp, &cur, 0, req));
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_handle_uma_zone_flags(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct sbuf sbuf;
|
||||
uma_zone_t zone = arg1;
|
||||
int error;
|
||||
|
||||
sbuf_new_for_sysctl(&sbuf, NULL, 0, req);
|
||||
if (zone->uz_flags != 0)
|
||||
sbuf_printf(&sbuf, "0x%b", zone->uz_flags, PRINT_UMA_ZFLAGS);
|
||||
else
|
||||
sbuf_printf(&sbuf, "0");
|
||||
error = sbuf_finish(&sbuf);
|
||||
sbuf_delete(&sbuf);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
#ifdef INVARIANTS
|
||||
static uma_slab_t
|
||||
uma_dbg_getslab(uma_zone_t zone, void *item)
|
||||
|
@ -420,6 +420,32 @@ struct uma_zone {
|
||||
#define UMA_ZFLAG_INHERIT \
|
||||
(UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY | UMA_ZFLAG_BUCKET)
|
||||
|
||||
#define PRINT_UMA_ZFLAGS "\20" \
|
||||
"\40CACHEONLY" \
|
||||
"\37TRASH" \
|
||||
"\36INTERNAL" \
|
||||
"\35BUCKET" \
|
||||
"\34RECLAIMING" \
|
||||
"\33CACHE" \
|
||||
"\22MINBUCKET" \
|
||||
"\21NUMA" \
|
||||
"\20PCPU" \
|
||||
"\17NODUMP" \
|
||||
"\16VTOSLAB" \
|
||||
"\15CACHESPREAD" \
|
||||
"\14MAXBUCKET" \
|
||||
"\13NOBUCKET" \
|
||||
"\12SECONDARY" \
|
||||
"\11HASH" \
|
||||
"\10VM" \
|
||||
"\7MTXCLASS" \
|
||||
"\6NOFREE" \
|
||||
"\5MALLOC" \
|
||||
"\4OFFPAGE" \
|
||||
"\3STATIC" \
|
||||
"\2ZINIT" \
|
||||
"\1PAGEABLE"
|
||||
|
||||
#undef UMA_ALIGN
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
Loading…
Reference in New Issue
Block a user