Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Mar 2022 16:32:23 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 543157870da5 - stable/13 - rmlock: Micro-optimize read locking
Message-ID:  <202203041632.224GWNEh009683@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=543157870da529e06c6cd6bfe8672b527b0c2067

commit 543157870da529e06c6cd6bfe8672b527b0c2067
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-02-25 18:42:51 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203041632.224GWNEh009683>