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 c84bb8cd77
)
This commit is contained in:
parent
69b2217cde
commit
543157870d
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user