Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Mar 2019 19:45:37 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344823 - in head: sys/kern sys/sys usr.bin/procstat
Message-ID:  <201903051945.x25Jjc8t084792@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Mar  5 19:45:37 2019
New Revision: 344823
URL: https://svnweb.freebsd.org/changeset/base/344823

Log:
  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

Modified:
  head/sys/kern/kern_proc.c
  head/sys/sys/user.h
  head/usr.bin/procstat/procstat.1
  head/usr.bin/procstat/procstat_vm.c

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Tue Mar  5 19:41:32 2019	(r344822)
+++ head/sys/kern/kern_proc.c	Tue Mar  5 19:45:37 2019	(r344823)
@@ -2487,6 +2487,8 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s
 			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);

Modified: head/sys/sys/user.h
==============================================================================
--- head/sys/sys/user.h	Tue Mar  5 19:41:32 2019	(r344822)
+++ head/sys/sys/user.h	Tue Mar  5 19:45:37 2019	(r344823)
@@ -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

Modified: head/usr.bin/procstat/procstat.1
==============================================================================
--- head/usr.bin/procstat/procstat.1	Tue Mar  5 19:41:32 2019	(r344822)
+++ head/usr.bin/procstat/procstat.1	Tue Mar  5 19:45:37 2019	(r344823)
@@ -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 ,

Modified: head/usr.bin/procstat/procstat_vm.c
==============================================================================
--- head/usr.bin/procstat/procstat_vm.c	Tue Mar  5 19:41:32 2019	(r344822)
+++ head/usr.bin/procstat/procstat_vm.c	Tue Mar  5 19:45:37 2019	(r344823)
@@ -53,7 +53,7 @@ procstat_vm(struct procstat *procstat, struct kinfo_pr
 
 	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_pr
 		    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_pr
 		    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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903051945.x25Jjc8t084792>