git: 4d5f771c439d - stable/14 - kinfo_vmobject: report backing object of the SysV shm segments
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Oct 2024 15:05:26 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=4d5f771c439df34d3c205acbd13eb1250095eeb0
commit 4d5f771c439df34d3c205acbd13eb1250095eeb0
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-10-05 09:20:21 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-15 14:50:16 +0000
kinfo_vmobject: report backing object of the SysV shm segments
(cherry picked from commit 6a3fbdc7e9c8323a1c13c4afcc65f89cb47911e6)
---
sys/sys/user.h | 5 ++++-
sys/vm/vm_object.c | 11 +++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/sys/sys/user.h b/sys/sys/user.h
index 70592eb44668..47f2984b1eff 100644
--- a/sys/sys/user.h
+++ b/sys/sys/user.h
@@ -579,6 +579,8 @@ struct kinfo_vmentry {
#define kve_vn_fsid kve_type_spec._kve_vn_fsid
#define kve_obj kve_type_spec._kve_obj
+#define KVMO_FLAG_SYSVSHM 0x0001
+
/*
* The "vm.objects" sysctl provides a list of all VM objects in the system
* via an array of these entries.
@@ -602,7 +604,8 @@ struct kinfo_vmobject {
uint64_t kvo_me; /* Uniq handle for anon obj */
uint64_t _kvo_qspare[6];
uint32_t kvo_swapped; /* Number of swapped pages */
- uint32_t _kvo_ispare[7];
+ uint32_t kvo_flags;
+ uint32_t _kvo_ispare[6];
char kvo_path[PATH_MAX]; /* Pathname, if any. */
};
#define kvo_vn_fsid kvo_type_spec._kvo_vn_fsid
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 76ae6118a756..a8821f0f2a8b 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -69,6 +69,7 @@
#include <sys/systm.h>
#include <sys/blockcount.h>
#include <sys/cpuset.h>
+#include <sys/ipc.h>
#include <sys/jail.h>
#include <sys/limits.h>
#include <sys/lock.h>
@@ -79,6 +80,7 @@
#include <sys/pctrie.h>
#include <sys/proc.h>
#include <sys/refcount.h>
+#include <sys/shm.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/resourcevar.h>
@@ -2517,6 +2519,8 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
vm_page_t m;
u_long sp;
int count, error;
+ key_t key;
+ unsigned short seq;
bool want_path;
if (req->oldptr == NULL) {
@@ -2564,6 +2568,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
kvo->kvo_memattr = obj->memattr;
kvo->kvo_active = 0;
kvo->kvo_inactive = 0;
+ kvo->kvo_flags = 0;
if (!swap_only) {
TAILQ_FOREACH(m, &obj->memq, listq) {
/*
@@ -2601,6 +2606,12 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
kvo->kvo_swapped = sp > UINT32_MAX ? UINT32_MAX : sp;
}
VM_OBJECT_RUNLOCK(obj);
+ if ((obj->flags & OBJ_SYSVSHM) != 0) {
+ kvo->kvo_flags |= KVMO_FLAG_SYSVSHM;
+ shmobjinfo(obj, &key, &seq);
+ kvo->kvo_vn_fileid = key;
+ kvo->kvo_vn_fsid_freebsd11 = seq;
+ }
if (vp != NULL) {
vn_fullpath(vp, &fullpath, &freepath);
vn_lock(vp, LK_SHARED | LK_RETRY);