procstat: distinguish vm map guards in procstat vm output.

Requested and reviewed by:	rwatson (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28658
This commit is contained in:
Konstantin Belousov 2021-02-14 02:37:24 +02:00
parent bffc3fb3c0
commit 25c6318c79
4 changed files with 13 additions and 3 deletions

View File

@ -2514,7 +2514,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
vm_offset_t addr;
unsigned int last_timestamp;
int error;
bool super;
bool guard, super;
PROC_LOCK_ASSERT(p, MA_OWNED);
@ -2584,6 +2584,8 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
if (entry->eflags & MAP_ENTRY_USER_WIRED)
kve->kve_flags |= KVME_FLAG_USER_WIRED;
guard = (entry->eflags & MAP_ENTRY_GUARD) != 0;
last_timestamp = map->timestamp;
vm_map_unlock_read(map);
@ -2620,7 +2622,8 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
vput(vp);
}
} else {
kve->kve_type = KVME_TYPE_NONE;
kve->kve_type = guard ? KVME_TYPE_GUARD :
KVME_TYPE_NONE;
kve->kve_ref_count = 0;
kve->kve_shadow_count = 0;
}

View File

@ -465,6 +465,7 @@ struct kinfo_file {
#define KVME_TYPE_DEAD 6
#define KVME_TYPE_SG 7
#define KVME_TYPE_MGTDEVICE 8
#define KVME_TYPE_GUARD 9
#define KVME_TYPE_UNKNOWN 255
#define KVME_PROT_READ 0x00000001

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 24, 2020
.Dd February 13, 2021
.Dt PROCSTAT 1
.Os
.Sh NAME
@ -674,6 +674,8 @@ scatter/gather
swap
.It vn
vnode
.It gd
guard (pseudo-type)
.El
.Pp
The following mapping flags may be displayed:

View File

@ -155,6 +155,10 @@ procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp)
str = "md";
lstr = "managed_device";
break;
case KVME_TYPE_GUARD:
str = "gd";
lstr = "guard";
break;
case KVME_TYPE_UNKNOWN:
default:
str = "??";