From nobody Fri Mar 04 16:32:57 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 7FE9A19E7566; Fri, 4 Mar 2022 16:32:57 +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 4K9D152xd2z3tq3; Fri, 4 Mar 2022 16:32:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646411577; 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=1Li8IoOCHLCYGB3pOWeV4bO+LfeVsjnWAu1ndnXGxRI=; b=brhuKGHvaoicbFL86ZlaX9rmCgGfxa3t3oPKfxGrAXnjJjt2ILI8yQr+KXAth4NYEia1v8 +JDmtqptVxO+bjXCGQiAix8vdEFPyJDAGteVdwkGwYzxJZzwg0GtynrIsNAHfnwxRiOov/ gFTqbj5QDfMLhSylY7lpQAKOhS9AXjJ5SCrbBDjx/O3Rh3Y8F7gVN7ttHnTHWcqvY0Nzsj oUb55GhIuRmKwmrD69u53CzF0AFJGAUSG34rm9OezDa0UB4mh18yiBkv1CKNbSstbCfBPL iWTr1t8Gn1xpFgl7JIqltOXGTgT6HoF7ZnqWtXJiaCWRo3Tc6hBzyVEBPbHZiQ== 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 4563B7B80; Fri, 4 Mar 2022 16:32:57 +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 224GWvMe011480; Fri, 4 Mar 2022 16:32:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 224GWvfX011479; Fri, 4 Mar 2022 16:32:57 GMT (envelope-from git) Date: Fri, 4 Mar 2022 16:32:57 GMT Message-Id: <202203041632.224GWvfX011479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 0782a20dc550 - stable/12 - rmlock: Micro-optimize read locking 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0782a20dc550a4b05385017eb2728fb92192124b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646411577; 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=1Li8IoOCHLCYGB3pOWeV4bO+LfeVsjnWAu1ndnXGxRI=; b=N+mpMUYSymQSWyoJ9JnEPIW7mEUy4gYyBr4YwaAMuhNEAU3ayTvCLLwH7E7TaAdQ9N+6YW FEm2XuTlORrCplsnD7IAyLTi5ysa5Bu0qCUFz0AQAfk7K31BwXEaySIB7q8O6pG8Mso3hW 6sBEqI99Msk5Qcdcx6K1KfkwPDz/KT+lWabLv/ih1Ew9MmCVxXjIOA2mXu6D6/b0LzER41 3+x04hEdcsMuQ2ygvh3Blf3pFYbM+VM+hWVZYu13ycwjsZOXdai8IC9u4xvu3CtTwKgwz3 bSeo18slSnzKS2TmHsJMz+6OhLB/VhvRcdKcPF/VX2TJ6/LstVyNfFPvXu4+Yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646411577; a=rsa-sha256; cv=none; b=EMO9oKEdfwBG9HuDyWNWbg5nh/U8Ty+q41lUFfM/zIPjSipx1p3o/iUbN0R4Q2Vwt9/vjN E6gXnwPZCXq+WkLLZ83YPDdevqVfiXWwHyrERMi3IQKawx9OUHI7xx1wJOXUyyZ2iX9CJ3 N6UHoiCENNbW14quzXUqC3c2R8CQcfnB3H1m1FmXnVF8LZT/nXIEgOhLKA1q2Z3w/CTLC4 uPgd+y/i5Z94y9/1JJgQpyANnGwUkko7uLsP9hwl510QyBVnztdCbkfWOktkhfGcekQIP4 QHexSHj6Q9rGk6ft4+/a2kWiewm8tDOhIVB3hZuu9VSxNhVKGsgq5eEi3ixY/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0782a20dc550a4b05385017eb2728fb92192124b commit 0782a20dc550a4b05385017eb2728fb92192124b Author: Mark Johnston AuthorDate: 2022-02-25 18:42:51 +0000 Commit: Mark Johnston CommitDate: 2022-03-04 16:32:41 +0000 rmlock: Micro-optimize read locking Use get_pcpu() instead of an open-coded pcpu_find(td->td_oncpu). This eliminates some memory accesses and results in a shorter instruction sequence. Note that get_pcpu() didn't exist when rmlocks were added. Reviewed by: jah, mjg Sponsored by: The FreeBSD Foundation (cherry picked from commit c84bb8cd771ce4bed58152e47a32dda470bef23a) --- sys/kern/kern_rmlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 585ccce6d2a4..45290ac5d562 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -451,7 +451,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) __compiler_membar(); - pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ + pc = get_pcpu(); rm_tracker_add(pc, tracker); @@ -516,7 +516,7 @@ _rm_runlock(struct rmlock *rm, struct rm_priotracker *tracker) return; td->td_critnest++; /* critical_enter(); */ - pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ + pc = get_pcpu(); rm_tracker_remove(pc, tracker); td->td_critnest--; sched_unpin();