From nobody Thu May 19 18:42:59 2022 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 1A5891AE403F; Thu, 19 May 2022 18:43:00 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L3zJ40Cv0z4SfS; Thu, 19 May 2022 18:43:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652985780; 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=lfbhvOaxLj5uf1iXrXXe1pAJFbSk7+U9RNCZ1dfMV3s=; b=rAahkbOa0x8xOsoC46jnHDgJ5zU0tzbX9P3JnwehZKOwq1uMsHOc8owUC3zgczy4eEBKOG YLouiM/+lPJKPuRrR6fUpRPUaY3XYBBRU3Ce2GHwdLflFQpLIOr0d2iANeQ4s5Hhi58FxF SGaqd+1AkOGvFaB3FiMLxNEuk5XVZN30Fh0Hz6dLsbgl1ThVqe4Ca70G/u/1QQO/Sf+hba ZbHl/uM0N61g05Aqhpy/pOu0f30mnWpCeVK+duZwouDHPYQ7DhSUSJTZm4d7r+uYwmJXFo cbfZfEDrJcPIigVcMyRDVJ246iYQAxb4H77m2o36OhAd6vEJ3yEYeyIkX1oYRA== 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 DB6A123309; Thu, 19 May 2022 18:42:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 24JIgxRB011240; Thu, 19 May 2022 18:42:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24JIgxZm011239; Thu, 19 May 2022 18:42:59 GMT (envelope-from git) Date: Thu, 19 May 2022 18:42:59 GMT Message-Id: <202205191842.24JIgxZm011239@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: b04f5d18b5fa - main - linux(4): To improve readability use FUTEX_UNOWNED instead of 0 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b04f5d18b5faad004a10f054d9c9072fcf31c29b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652985780; 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=lfbhvOaxLj5uf1iXrXXe1pAJFbSk7+U9RNCZ1dfMV3s=; b=PsNoKAz1NvLm1EoXx78O+fK0DciwsAFpX8MIJdmD7mzPTL1TdhWXzjthuTJN8VarhBEXBB BXQU9Mt0sYPMw2nrjyJuVmLeGC0QlfWk0J/DqlXFSnK64Dg0/ePv2mNZ6V6HKxyeqD04vR tc07LhQuGT+yOc4MqrWBLIJPGBPOinGaJ9HJmVa2oESVDvBFrBwlSdrFLAO3WVf1iwAGDC i5rtVrHfAfZhFsB7FCm96fRScaMx84SAZvoCAJzBoqbbL7Zib65+sJnUpoBKrXisfxj7vz ELKdWEO/TUmj6h3h5g7dDW4fUKSCR2I8nF2YcaeV+5EYpcoFOvvv/oNiSZ+iwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652985780; a=rsa-sha256; cv=none; b=qnOCFQu/C4QTB7QZ0Tjs1PhzwQjJCUzbNOuELVlFU3nFQUvWnepv2qe3Fi2UNPuVdmbDZs umfp+8qSL3RpRT5tZttnBh2nIlzpLc15B6D02SVfb6euz7JBega5MbHLnG1KHv4S1+JlZz kAGjAwZSllIj4h1YqZSeHEt9vHjIpSyFnrP00F2M3bg3Uae8zc1GXBHSjZGMV4lpehWar3 g68vpqYeZPJgQKdcm70+3zXrsmpFgYiCkonCO0V+tENs35VFO+CrAByrzJwVBMATmZf7RK z7pBr2+DcEN/iNauCFPdre9aFE0ooI7aw6jdgmoYSoK8kYp0Us0QOPYOnEeCzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b04f5d18b5faad004a10f054d9c9072fcf31c29b commit b04f5d18b5faad004a10f054d9c9072fcf31c29b Author: Dmitry Chagin AuthorDate: 2022-05-19 18:42:38 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-19 18:42:38 +0000 linux(4): To improve readability use FUTEX_UNOWNED instead of 0 MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 8bcdc378cf70..eb3ce3421465 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #define FUTEX_SHARED 0x8 /* shared futex */ +#define FUTEX_UNOWNED 0 #define GET_SHARED(a) (a->flags & FUTEX_SHARED) ? AUTO_SHARE : THREAD_SHARE @@ -399,7 +400,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) umtxq_unlock(&uq->uq_key); for (;;) { /* Try uncontested case first. */ - rv = casueword32(args->uaddr, 0, &owner, em->em_tid); + rv = casueword32(args->uaddr, FUTEX_UNOWNED, &owner, em->em_tid); /* The acquire succeeded. */ if (rv == 0) { error = 0; @@ -414,7 +415,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) * Nobody owns it, but the acquire failed. This can happen * with ll/sc atomic. */ - if (owner == 0) { + if (owner == FUTEX_UNOWNED) { error = thread_check_susp(td, true); if (error != 0) break; @@ -441,7 +442,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) * Futex owner died, handle_futex_death() set the OWNER_DIED bit * and clear tid. Try to acquire it. */ - if ((owner & FUTEX_TID_MASK) == 0) { + if ((owner & FUTEX_TID_MASK) == FUTEX_UNOWNED) { old_owner = owner; owner = owner & (FUTEX_WAITERS | FUTEX_OWNER_DIED); owner |= em->em_tid; @@ -486,7 +487,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) * Linux does some checks of futex state, we return EINVAL, * as the user space can take care of this. */ - if ((owner & FUTEX_OWNER_DIED) != 0) { + if ((owner & FUTEX_OWNER_DIED) != FUTEX_UNOWNED) { error = EINVAL; break; } @@ -608,7 +609,7 @@ linux_futex_unlock_pi(struct thread *td, bool rb, struct linux_futex_args *args) if (count > 1) new_owner = FUTEX_WAITERS; else - new_owner = 0; + new_owner = FUTEX_UNOWNED; again: error = casueword32(args->uaddr, owner, &old, new_owner);