From nobody Fri Oct 11 10:15:09 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XQ2Yp1gKnz5YfF7; Fri, 11 Oct 2024 10:15:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XQ2Yn5RsGz4GXB; Fri, 11 Oct 2024 10:15:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728641709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X5Q8+OubPWB5xWXfy/VyFk25LkhCHPF2Ukeh+3H42r8=; b=Ryw89V+bGG/gTyBFbGeoVGjdu8GqcLDhAUs/Ot8TzW64f1x9R6flA+TQvY4jDsP7F2FUIW K1162t0Ek+1P/UNSrxia/KaNi6tTAo+BDaNrTK2KwSi+tNA6NQ+z3mqg8z0gi6xZ4A/Q2L bvbKY8cNFARxFKNyohCuttvcx6Tb/M5U6npM7iXbYNe3sGy0EYhgnXaEtzHGLN+ZNEj5dK bFmdnVuExZi7usKPZotdt9u2FP7G6EbabwSoYIn7/B1W2scybCAYfAl5J3hToNWf3TXLSR IwAghe+/7VOtFygyZNAOWHlvwcX2RFLsIhMonYn/eukOg6MCPouvy6olvfdHVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728641709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X5Q8+OubPWB5xWXfy/VyFk25LkhCHPF2Ukeh+3H42r8=; b=hoQ30zR4j8Qt786fEghNBZ7DmcQOkbNa7MHnKvMZz68U6d63/MfoAeoSPmGDrpGMWwuFPp AfyjGTgjXZfOCF1Ux2/kaIUrsAdlwFqvJ+hHm/N56vOASfOjoBX2EwvkTDZNyiQg2YIlN6 jnV11uvzm1gLpCFlq8JoTGzTeeiLFbbEwsUbPx3eCEyX9avwasg6uSBbaiE+D9I4XUvWzO w2M5VhHT90/+L/cZsB8VWq4yUBMyffRF5dHuJuEutD+peQf1JrFECXFGiaDy8c4IjeyASx xIJtitprwAV/Zsje2Si2JRZHCD0gm4Ds941jnwlJ8nozNjmSpdcfYvmEq7z+IQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728641709; a=rsa-sha256; cv=none; b=vgc9hKPh3cDNfZ032ym7zB9sbz+zlFAA/s6NOhDMwq1H5MxeXz6y1a3HUh3boUQa7D9Omt dOsd+dC7ZRMvwRLVzbwmAFX22hM7H0M3LkF1sdJy5dZZdTK0KwT0QQ7b3YuPyyhoXgdeNZ 8fpKx4GamLZYAZ2c0CH9j8dz91StjXFWyYgpPR6pA2QC7NAVEL7ICAYabNK2OyB8cVYRdL 72uJFn5Re85WOosuBd2IbfLToBzV5klxnBQbZYdpk3hN1cN2Pa4hyPwfxmJJ5Ow1DowzCk RJuz0j8ODW9lT5kuzYYTZXK1hH9axeuh1t0Pl1RxVXGo/xKK5cJCPsftf/yppA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XQ2Yn3n4wzdr8; Fri, 11 Oct 2024 10:15:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49BAF9LN011996; Fri, 11 Oct 2024 10:15:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49BAF9gY011993; Fri, 11 Oct 2024 10:15:09 GMT (envelope-from git) Date: Fri, 11 Oct 2024 10:15:09 GMT Message-Id: <202410111015.49BAF9gY011993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d9daa28c364d - main - sysctl vm.vm_objects: report cdev name for device-backed objects List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d9daa28c364d0b1189ab616d8d697b4c9f748038 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d9daa28c364d0b1189ab616d8d697b4c9f748038 commit d9daa28c364d0b1189ab616d8d697b4c9f748038 Author: Konstantin Belousov AuthorDate: 2024-10-10 09:37:19 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-11 10:14:15 +0000 sysctl vm.vm_objects: report cdev name for device-backed objects Reviewed by: emaste. markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47038 --- sys/vm/vm_object.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 0b9a8af2ccb1..83d6b709e277 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -66,6 +66,7 @@ #include #include +#include #include #include #include @@ -2506,8 +2507,10 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) struct vattr va; vm_object_t obj; vm_page_t m; + struct cdev *cdev; + struct cdevsw *csw; u_long sp; - int count, error; + int count, error, ref; key_t key; unsigned short seq; bool want_path; @@ -2594,6 +2597,17 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) sp = swap_pager_swapped_pages(obj); kvo->kvo_swapped = sp > UINT32_MAX ? UINT32_MAX : sp; } + if (obj->type == OBJT_DEVICE || obj->type == OBJT_MGTDEVICE) { + cdev = obj->un_pager.devp.dev; + if (cdev != NULL) { + csw = dev_refthread(cdev, &ref); + if (csw != NULL) { + strlcpy(kvo->kvo_path, cdev->si_name, + sizeof(kvo->kvo_path)); + dev_relthread(cdev, ref); + } + } + } VM_OBJECT_RUNLOCK(obj); if ((obj->flags & OBJ_SYSVSHM) != 0) { kvo->kvo_flags |= KVMO_FLAG_SYSVSHM;