git: c84bb8cd771c - main - rmlock: Micro-optimize read locking
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Feb 2022 18:56:47 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c84bb8cd771ce4bed58152e47a32dda470bef23a commit c84bb8cd771ce4bed58152e47a32dda470bef23a Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-02-25 18:42:51 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-02-25 18:55:24 +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 MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34377 --- 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();