From nobody Wed Oct 09 11:42:35 2024 X-Original-To: dev-commits-src-main@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 4XNrbb5xbsz5YRXV; Wed, 09 Oct 2024 11:42:35 +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 4XNrbb5Sdtz4S0W; Wed, 9 Oct 2024 11:42:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728474155; 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=UAbpIb2DPcS5b/vjcSm5Ty4Ymmc7fv5u0fNuWBqx+68=; b=x3da38dAghYFymBBDWSKpDhoOinmSkeCq73T/BWIRyjUTcBhRxhD2IdRlkBB3OafZbxMbs GgcUFHwFFACTlcdreF8xPOczOLhrou+qGn49mLSprYML5elZ+HpcIuZJ7M8IYbdDJM7Fc1 DuQXpq8fXlOIX6WZ2w+SEq2wy7wbPSB/RtXxMWcYRLQpb75++UV4cbYnl0ktSFW4BhawlC b5pGieDDTymwZwQ6pGU7i/C13Hh/B+w5HPOHZraqKslAy1iUGEmfd8cfPp8zPyCLhafEdG JCYckscjPdS8JD0xPrkdoISFNsk8Wmun4v78vP2vdMcrqApKcsASJUiB2cMDrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728474155; 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=UAbpIb2DPcS5b/vjcSm5Ty4Ymmc7fv5u0fNuWBqx+68=; b=m2EbmBK34nkJCYC4TEK31hHwN0Xlikwk0a4BnzYBSUuVTHh+D/z2aAcuO1iNFOtuDKul4b aMv8oa5Lr1qoEic8L+l7kG0FN/+KMn2yKut7mAhgqJxia2810Gl4QVmaH6UXgrV8nNV4mE vOC9Gn43tJr6qcGf8lozv5rrPAvx6yPYAU2NEh2gp3QD+J8EOmIayjIcJmauMvme1axPb3 XnALN3fdwf71maW2CHixMKJXdGiQqom0W9fLNFi/4FZmehINWW8RDiOgvwojW+SlBGBEKk qh2pMCChyMDj0L24kfgnta9NtDNbgkq9UHpTDmbc/UjQbdJonhSh98+VPKLpnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728474155; a=rsa-sha256; cv=none; b=gFFrTNYGMl6KfPPqNJQAcxhZXcNE2TLyXVSlzHKUfZ6qe+Uhm9tEd4KNrTbasIm6ZGzyS6 YpFGfKW5tKiuJVJIiaaHvSjMWkXMEgoxZJ2UMTHNr5GqhoGTdwWs5pMRZflEEu3EkWlH9F J69C07H33bStBespbCvpgRb3L1wgcvOicAPNLa8rHV1mrm5OrPh6IORhKt48lBsTrK1tUS cLh29me06zvehNTQDEFaYEQwlNbhkyhUnCPoPdPDNMeisPclZXjMQajP6ICy7z55A7oRHE I92Sq6+VSt0iwWQ7rAel433ctux6ELmp086bsLstyR/VUZetL/YH2qxeOiJ57w== 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 4XNrbb53rGz1C62; Wed, 9 Oct 2024 11:42:35 +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 499BgZlU072534; Wed, 9 Oct 2024 11:42:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 499BgZIm072531; Wed, 9 Oct 2024 11:42:35 GMT (envelope-from git) Date: Wed, 9 Oct 2024 11:42:35 GMT Message-Id: <202410091142.499BgZIm072531@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: e578fd853a25 - main - shm_alloc(): cleanup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: e578fd853a251c04d1eeb55c3aa499f8d0cb7480 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e578fd853a251c04d1eeb55c3aa499f8d0cb7480 commit e578fd853a251c04d1eeb55c3aa499f8d0cb7480 Author: Konstantin Belousov AuthorDate: 2024-10-08 17:43:38 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-09 11:28:12 +0000 shm_alloc(): cleanup Consistently use the shorter name 'obj' for the new object. Set OBJ_POSIXSHM flag outside if, it is set on both pathes. Suggested by: alc Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47018 --- sys/kern/uipc_shm.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index f6861a3278ff..141d386af396 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -945,24 +945,20 @@ shm_alloc(struct ucred *ucred, mode_t mode, bool largepage) shmfd->shm_gid = ucred->cr_gid; shmfd->shm_mode = mode; if (largepage) { - 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 = phys_pager_allocate(NULL, &shm_largepage_phys_ops, + NULL, shmfd->shm_size, VM_PROT_DEFAULT, 0, ucred); 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; } - KASSERT(shmfd->shm_object != NULL, ("shm_create: vm_pager_allocate")); + KASSERT(obj != NULL, ("shm_create: vm_pager_allocate")); + VM_OBJECT_WLOCK(obj); + vm_object_set_flag(obj, OBJ_POSIXSHM); + VM_OBJECT_WUNLOCK(obj); + shmfd->shm_object = obj; vfs_timestamp(&shmfd->shm_birthtime); shmfd->shm_atime = shmfd->shm_mtime = shmfd->shm_ctime = shmfd->shm_birthtime;