From nobody Tue Oct 15 15:05:33 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 4XScq151P7z5YYbk; Tue, 15 Oct 2024 15:05:33 +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 4XScq11N5fz46Ks; Tue, 15 Oct 2024 15:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729004733; 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=n00/AHV/zXNQKRwmnLZUY64j5ezF+iSj/zKSgIwGtx8=; b=ipCOoE3dYKjYgy3ySrJBL1sDtWphRpjn0KOPP5uD07uwXmO20kPlkK9ve+1ByAu7sgPqLm BBEzsUCjOS2EnVmClnc+GNeJuntIh7fsN90TLZzhoNXLG8bW7nqFt3Oj95dN02ZefYqs79 1LoMw826mqGhLoFS0ulSDGIZsxPNR8dQXRCZweeK8FLmEeusJXIVqz1ynCS2xYkhHd+5WI Zujj/bIzqteyEDNlocUW54Ze+CVyqalgq/Pz/9Kdwi3Jozdp+oo4jOz6nl07OzWAlpUva7 i/3mP/0rXUqW/vCixhzgtMBZGqnmoPkWD6iMPiMPDjJ5Ep3iz0udnimQJ9s1Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729004733; 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=n00/AHV/zXNQKRwmnLZUY64j5ezF+iSj/zKSgIwGtx8=; b=Z7fvK1dNoEKez27pISdDwpOzNzo/RCspSKoszKmuXNURC8WQU3PXwAjijy88yoN7kLNvof IpT9el/VnKzIEJFmyOgST+yPk/1RHIAdQKq8shtgIFu5FAm7c+/TTrkMAmuU6IBs/J7xOA y/RgwlbIc850oX0GEYnzGylT/MwO6ndfEpUFILxL6CAScvhFfH95vSxmQvK0Rq2M56RHQf Vd1pHuAqUnVKepBUWgc6DZcynIyQMZG4GfxV4DxBw+18Cv8HcbG1iTcsOmZ2mivN/2cs3+ bYjhNmB8NKamKweyPmYplo56QNSsCl+X4BDMCNmMDwx+MOyHuAyqWPubkH6qsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729004733; a=rsa-sha256; cv=none; b=KnQ4rMxosOU9Pb5IQWzIEhOy072dHCvkqYChDhRWg9iS/WJIUAVFsYJJffzd5zaJSuYHkG YjvIA3+y2eW3D1ew1Q0XVOSoNPxVWeYDuQLn0eugLSipmA1E8EHNg0EOzzecOHgt8RdRNU qar0ZRz6J5qDo5L2yjgy9NfJTYia8BgEAAzJUnRDgez+T6obwgEd2ugAuczBQONLCyJ3sg k+g+nfiVNQMQzOHxtiZ8FE2Od0Pm/ihIQS310DhIOKR8tG0W7BLQmxqjre4dZoN4mfFiK8 t18epuaYLNTzIwhyoAhlSiVhrwK/IbTOLscvtW0sI4sMmCBEvMVZlScgE++Esw== 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 4XScq10ywyzRT6; Tue, 15 Oct 2024 15:05:33 +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 49FF5X8c089569; Tue, 15 Oct 2024 15:05:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FF5XcJ089566; Tue, 15 Oct 2024 15:05:33 GMT (envelope-from git) Date: Tue, 15 Oct 2024 15:05:33 GMT Message-Id: <202410151505.49FF5XcJ089566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ec35a9c65d2d - stable/14 - posix shm: mark backing objects with SHM_POSIXSHM flag 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/stable/14 X-Git-Reftype: branch X-Git-Commit: ec35a9c65d2dc27f10097f08ee4ad3c2bf598471 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ec35a9c65d2dc27f10097f08ee4ad3c2bf598471 commit ec35a9c65d2dc27f10097f08ee4ad3c2bf598471 Author: Konstantin Belousov AuthorDate: 2024-10-07 01:26:38 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-15 14:50:17 +0000 posix shm: mark backing objects with SHM_POSIXSHM flag (cherry picked from commit a10870ecea813042db7c41e906e1a5c5693f8a34) --- sys/kern/uipc_shm.c | 16 +++++++++++----- sys/vm/vm_object.h | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 20dbe59e2a96..52a569931b01 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -944,15 +944,20 @@ shm_alloc(struct ucred *ucred, mode_t mode, bool largepage) shmfd->shm_gid = ucred->cr_gid; shmfd->shm_mode = mode; if (largepage) { - shmfd->shm_object = phys_pager_allocate(NULL, + obj = shmfd->shm_object = phys_pager_allocate(NULL, &shm_largepage_phys_ops, NULL, shmfd->shm_size, VM_PROT_DEFAULT, 0, ucred); + VM_OBJECT_WLOCK(shmfd->shm_object); + obj->un_pager.phys.phys_priv = shmfd; + vm_object_set_flag(obj, OBJ_POSIXSHM); + VM_OBJECT_WUNLOCK(shmfd->shm_object); shmfd->shm_lp_alloc_policy = SHM_LARGEPAGE_ALLOC_DEFAULT; } else { obj = vm_pager_allocate(shmfd_pager_type, NULL, shmfd->shm_size, VM_PROT_DEFAULT, 0, ucred); VM_OBJECT_WLOCK(obj); obj->un_pager.swp.swp_priv = shmfd; + vm_object_set_flag(obj, OBJ_POSIXSHM); VM_OBJECT_WUNLOCK(obj); shmfd->shm_object = obj; } @@ -992,11 +997,12 @@ shm_drop(struct shmfd *shmfd) rangelock_destroy(&shmfd->shm_rl); mtx_destroy(&shmfd->shm_mtx); obj = shmfd->shm_object; - if (!shm_largepage(shmfd)) { - VM_OBJECT_WLOCK(obj); + VM_OBJECT_WLOCK(obj); + if (shm_largepage(shmfd)) + obj->un_pager.phys.phys_priv = NULL; + else obj->un_pager.swp.swp_priv = NULL; - VM_OBJECT_WUNLOCK(obj); - } + VM_OBJECT_WUNLOCK(obj); vm_object_deallocate(obj); free(shmfd, M_SHMFD); } diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index c63a52260baf..9921f1130e8c 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -174,6 +174,7 @@ struct vm_object { void *data_ptr; uintptr_t data_val; }; + void *phys_priv; } phys; } un_pager; struct ucred *cred; @@ -204,6 +205,7 @@ struct vm_object { #define OBJ_PAGERPRIV1 0x00004000 /* Pager private */ #define OBJ_PAGERPRIV2 0x00008000 /* Pager private */ #define OBJ_SYSVSHM 0x00010000 /* SysV SHM */ +#define OBJ_POSIXSHM 0x00020000 /* Posix SHM */ /* * Helpers to perform conversion between vm_object page indexes and offsets.