From nobody Wed Sep 04 14:48:17 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 4WzQN161XNz5V2wC; Wed, 04 Sep 2024 14:48:17 +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 4WzQN15YMjz4Hpf; Wed, 4 Sep 2024 14:48:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725461297; 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=sDRIeBUmlPJ1EcC1rHUFs1K512DsEzLAE01adXusEfM=; b=n78Fc7ajWcWGhJ/sXW9ABtLjk0U3STQc3u1r+/FQGEdMwhKlCGjFT/u1H/qkzxcsjKd3lD V1tPcFUpW53INLhtx9/bNRQFExNOwK0vIccsm2YF9WfRaGV4rxNIZUDppk/lzYeeiqwp+8 ywkHRAyM2MXLAyJS+Ak6n16YkkOp1qqYiPk31FjJ9w/D5g3lmCDsjSquUNxfnpKiSz0BqW 6RNnGeBvzPOfqxOVZ3afXvShIvpRwnXRUl5sJl91oMY4MiUh1eX63P1iFq4APKLkNDDeXM Fls/5Ok4ssgpNvqwZxJxMOHLTXGuLfFIlLNIgs5QDbJOUYOQ8zSJuk4d2LVHEw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725461297; a=rsa-sha256; cv=none; b=rTecKuuEhKMpOxmFA5usqFDvkUR0pbX6voThS3upr0tWUjoco0MO2kv0TiEcFfaSvP5KER WzyduwrAc89S+4DsJrnC6s3aTbUFnHDv2QIxLvOyhdtX9B6ROKoKokDX7j3aZG9iYI5aBY 3xwPfAf7atjR3OT8Q5jpwQtQjSpWERutlJBhIFvCCojtIm8pP9LpNWPb+R8SwDN2XSVy0K UWvLQySCD8EgHbECZXPmXgVhsE0YdSb9Iqk7hc0H2eiKXIIP1r9YVSb55KkDBvwdHG/g// 5lw5gfPua2kyuN3kqo+2Vh4EwauXlXM318yHTOA7ABeMJRdZH4s51Rp5wONtRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725461297; 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=sDRIeBUmlPJ1EcC1rHUFs1K512DsEzLAE01adXusEfM=; b=XpSrE14mgjomeoZgsVxGueoJ3TPwOwd3HmfHwDsHDE4qyClI0PoHuyp2nUnzYAbxz5DDyX AqWvT0abghvtJCBJ3AAT9CjKTBHZuNRT1kQUbdBetscth+2X/YUELDEUPTCcK8fhbFU4gR av5bO5aXUbmI34LReUNOtuimk6x2qnfUxNGtjrxT/KR3QRgJyBgQHOcS7CGFmj2ic3hsdL qGzMBFt701iomMCP2iz1JH9Z41BFux7GNBDuUyCaMmd9drNiCP4L3PhQjnm1WBtMB2N7ht wY7Y7IOn4zigAJ2TDM088PWo33g+n8WQaryLpXZ+Oo8mPH8trDakhkvLAiHy1w== 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 4WzQN14lC3zSrf; Wed, 4 Sep 2024 14:48:17 +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 484EmHmv001295; Wed, 4 Sep 2024 14:48:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484EmHU0001292; Wed, 4 Sep 2024 14:48:17 GMT (envelope-from git) Date: Wed, 4 Sep 2024 14:48:17 GMT Message-Id: <202409041448.484EmHU0001292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: dd83da532c36 - main - umtx: shm: Collapse USHMF_REG_LINKED and USHMF_OBJ_LINKED flags 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd83da532c36830a0c0aac624903849262ec6f68 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=dd83da532c36830a0c0aac624903849262ec6f68 commit dd83da532c36830a0c0aac624903849262ec6f68 Author: Olivier Certner AuthorDate: 2024-09-04 14:38:12 +0000 Commit: Ed Maste CommitDate: 2024-09-04 14:38:12 +0000 umtx: shm: Collapse USHMF_REG_LINKED and USHMF_OBJ_LINKED flags ...into the only USHMF_LINKED, as they are always set or unset together. This is both to stop giving the impression that they can be set/unset independently, which they can't with the current code, and to make it clearer that an upcoming reference counting fix is correct. Reviewed by: kib Approved by: emaste (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46126 --- sys/kern/kern_umtx.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index e6d5e2de5e88..8d70438ea195 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -4293,8 +4293,7 @@ __umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap, #define USHM_OBJ_UMTX(o) \ ((struct umtx_shm_obj_list *)(&(o)->umtx_data)) -#define USHMF_REG_LINKED 0x0001 -#define USHMF_OBJ_LINKED 0x0002 +#define USHMF_LINKED 0x0001 struct umtx_shm_reg { TAILQ_ENTRY(umtx_shm_reg) ushm_reg_link; LIST_ENTRY(umtx_shm_reg) ushm_obj_link; @@ -4354,7 +4353,7 @@ umtx_shm_find_reg_locked(const struct umtx_key *key) KASSERT(reg->ushm_key.type == TYPE_SHM, ("TYPE_USHM")); KASSERT(reg->ushm_refcnt > 0, ("reg %p refcnt 0 onlist", reg)); - KASSERT((reg->ushm_flags & USHMF_REG_LINKED) != 0, + KASSERT((reg->ushm_flags & USHMF_LINKED) != 0, ("reg %p not linked", reg)); reg->ushm_refcnt++; return (reg); @@ -4394,14 +4393,11 @@ umtx_shm_unref_reg_locked(struct umtx_shm_reg *reg, bool force) reg->ushm_refcnt--; res = reg->ushm_refcnt == 0; if (res || force) { - if ((reg->ushm_flags & USHMF_REG_LINKED) != 0) { + if ((reg->ushm_flags & USHMF_LINKED) != 0) { TAILQ_REMOVE(&umtx_shm_registry[reg->ushm_key.hash], reg, ushm_reg_link); - reg->ushm_flags &= ~USHMF_REG_LINKED; - } - if ((reg->ushm_flags & USHMF_OBJ_LINKED) != 0) { LIST_REMOVE(reg, ushm_obj_link); - reg->ushm_flags &= ~USHMF_OBJ_LINKED; + reg->ushm_flags &= ~USHMF_LINKED; } } return (res); @@ -4494,7 +4490,7 @@ umtx_shm_create_reg(struct thread *td, const struct umtx_key *key, TAILQ_INSERT_TAIL(&umtx_shm_registry[key->hash], reg, ushm_reg_link); LIST_INSERT_HEAD(USHM_OBJ_UMTX(key->info.shared.object), reg, ushm_obj_link); - reg->ushm_flags = USHMF_REG_LINKED | USHMF_OBJ_LINKED; + reg->ushm_flags = USHMF_LINKED; mtx_unlock(&umtx_shm_lock); *res = reg; return (0);