The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0782a20dc550a4b05385017eb2728fb92192124b
commit 0782a20dc550a4b05385017eb2728fb92192124b Author: Mark Johnston <ma...@freebsd.org> AuthorDate: 2022-02-25 18:42:51 +0000 Commit: Mark Johnston <ma...@freebsd.org> 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();