From nobody Fri Mar 4 16:32:23 2022 X-Original-To: dev-commits-src-branches@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 1958F19E7407; Fri, 4 Mar 2022 16:32:24 +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 4K9D0S09lzz3tT8; Fri, 4 Mar 2022 16:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646411544; 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=xc/FMENbiT7p7bDPLUSxP7uomJEh+qOL1sCv8QGCc5E=; b=tbJIOuAJg/i7FR72wXTffs8YjCvj93PgX+Tzu3UwrXqRR4hva49yBGYVOUyM1ULPTRELIB hh3mO1ND1EwuZB947qJLEZEBx1LzCP2SRAuJplXpHfjOVXzpwXJHn8zBCQ8skqVVA9JDl3 EQVraAzg8mHTMAcWSxaSADk/BDa0QSujURbnifu7HdajV65ebL8XpeIAabCQ9qlsf9dAH4 1onRqbD34RE5+jaoJj0GcOp1COJ2cipU0WgdJNAJWEq/RxF5xDksCyISOpTUepFBHIRdTK NFiUCdirOqXRVCzLnkukLfEAqseixJO6l8HEZx0yy5wdKEG63MmxbOdchWLRdA== 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 DA6D47AA5; Fri, 4 Mar 2022 16:32:23 +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 224GWNS7009698; Fri, 4 Mar 2022 16:32:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 224GWNEh009683; Fri, 4 Mar 2022 16:32:23 GMT (envelope-from git) Date: Fri, 4 Mar 2022 16:32:23 GMT Message-Id: <202203041632.224GWNEh009683@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: 543157870da5 - stable/13 - rmlock: Micro-optimize read locking List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 543157870da529e06c6cd6bfe8672b527b0c2067 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646411544; 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=xc/FMENbiT7p7bDPLUSxP7uomJEh+qOL1sCv8QGCc5E=; b=R6/4QhcyvlmzfsbRfYqXgFyy9kQLdB4jnuek0kdy5ToTE2+GzWyCyV/t9iQMQMs4qRlaqb ZxMfHEBOxFyeS33vkUHfYYnfKsnAE80Iqc9nmcoPeeNrDfLOTm1esnbcDYjGuHIyTkKGIG 92KWkJHuId0/ajxUur+LRRpmBKO1g9D5Cx1YU1dtSSP1hsIONnC4aRCktUIsER8nfZaAnp r0Go22s5uHCAUFfI3/eGl//GiplxB46wKNZAhOwswiFjhxxkr3ifZ+s0XzPjCIg6xO1uZK tnnJ6ZtnB5l39D1XI3a4h0PIdPxbi19m7+84iERzAyXJXDvjrWVZYoyic47fQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646411544; a=rsa-sha256; cv=none; b=rXcCd+i8a2nph0ofjNaKV+YkskLhrr7EGgTlammyXV6CtKBZx9ViaXIwEWnDaR49Hd/FSq 63Y1E+sYh4rAEST49VSF03qoHF4DyYJWKXhkq7o8JFIWifxJu0PKkc5wPWBmlfufB2weP2 +8+T0xz601+ufyMoUZQ61x8XJ2VxLPgKDeDKR0LNcbxBriJTGk1xCBbz8LX2WL2QX05q1c UbDY0Rt5kntTuna2GCPOXWJbyPwDdTPslv9rn6Bh7YGYSOupyUv93ZHMsSassUwPk+t4gM 2KiKpHda6Jjsj0Ifx/RMffq22Xdhx91QRVTM3CJ+79txkDp51ZA2UAyyJPX2gg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=543157870da529e06c6cd6bfe8672b527b0c2067 commit 543157870da529e06c6cd6bfe8672b527b0c2067 Author: Mark Johnston AuthorDate: 2022-02-25 18:42:51 +0000 Commit: Mark Johnston CommitDate: 2022-03-04 16:32:14 +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 08a01fca9827..bbea8041360a 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -452,7 +452,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) atomic_interrupt_fence(); - pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ + pc = get_pcpu(); rm_tracker_add(pc, tracker); @@ -517,7 +517,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();