Show wiring state of map entries in procstat -v.

Note that only entries wired by userspace are shown as such.  In
particular, entries transiently wired by sysctl_wire_old_buffer() are
not flagged as wired in procstat -v output.

Reviewed by:	kib (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19461
This commit is contained in:
Mark Johnston 2019-03-05 19:45:37 +00:00
parent 3f877103dd
commit 6a85590370
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344823
4 changed files with 17 additions and 3 deletions

View File

@ -2487,6 +2487,8 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
kve->kve_flags |= KVME_FLAG_GROWS_UP;
if (entry->eflags & MAP_ENTRY_GROWS_DOWN)
kve->kve_flags |= KVME_FLAG_GROWS_DOWN;
if (entry->eflags & MAP_ENTRY_USER_WIRED)
kve->kve_flags |= KVME_FLAG_USER_WIRED;
last_timestamp = map->timestamp;
vm_map_unlock_read(map);

View File

@ -471,6 +471,7 @@ struct kinfo_file {
#define KVME_FLAG_SUPER 0x00000008
#define KVME_FLAG_GROWS_UP 0x00000010
#define KVME_FLAG_GROWS_DOWN 0x00000020
#define KVME_FLAG_USER_WIRED 0x00000040
#if defined(__amd64__)
#define KINFO_OVMENTRY_SIZE 1168

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 14, 2017
.Dd March 4, 2019
.Dt PROCSTAT 1
.Os
.Sh NAME
@ -662,6 +662,11 @@ one or more superpage mappings are used
grows down (top-down stack)
.It U
grows up (bottom-up stack)
.It W
pages in this range are locked by
.Xr mlock 2
or
.Xr mlockall 2
.El
.Ss ELF Auxiliary Vector
Display ELF auxiliary vector values:
@ -684,6 +689,8 @@ auxiliary vector value
.Xr sockstat 1 ,
.Xr cap_enter 2 ,
.Xr cap_rights_limit 2 ,
.Xr mlock 2 ,
.Xr mlockall 2 ,
.Xr libprocstat 3 ,
.Xr libxo 3 ,
.Xr signal 3 ,

View File

@ -53,7 +53,7 @@ procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp)
ptrwidth = 2*sizeof(void *) + 2;
if ((procstat_opts & PS_OPT_NOHEADER) == 0)
xo_emit("{T:/%5s %*s %*s %3s %4s %4s %3s %3s %-4s %-2s %-s}\n",
xo_emit("{T:/%5s %*s %*s %3s %4s %4s %3s %3s %-5s %-2s %-s}\n",
"PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES",
"PRES", "REF", "SHD", "FLAG", "TP", "PATH");
@ -98,9 +98,11 @@ procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp)
KVME_FLAG_NEEDS_COPY ? "N" : "-");
xo_emit("{d:super_pages/%-1s}", kve->kve_flags &
KVME_FLAG_SUPER ? "S" : "-");
xo_emit("{d:grows_down/%-1s} ", kve->kve_flags &
xo_emit("{d:grows_down/%-1s}", kve->kve_flags &
KVME_FLAG_GROWS_UP ? "U" : kve->kve_flags &
KVME_FLAG_GROWS_DOWN ? "D" : "-");
xo_emit("{d:wired/%-1s} ", kve->kve_flags &
KVME_FLAG_USER_WIRED ? "W" : "-");
xo_open_container("kve_flags");
xo_emit("{en:copy_on_write/%s}", kve->kve_flags &
KVME_FLAG_COW ? "true" : "false");
@ -112,6 +114,8 @@ procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp)
KVME_FLAG_GROWS_UP ? "true" : "false");
xo_emit("{en:grows_down/%s}", kve->kve_flags &
KVME_FLAG_GROWS_DOWN ? "true" : "false");
xo_emit("{en:wired/%s}", kve->kve_flags &
KVME_FLAG_USER_WIRED ? "true" : "false");
xo_close_container("kve_flags");
switch (kve->kve_type) {
case KVME_TYPE_NONE: