MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _rm_rlock

Function _rm_rlock

freebsd/kern/kern_rmlock.c:433–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433int
434_rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock)
435{
436 struct thread *td = curthread;
437 struct pcpu *pc;
438
439 if (SCHEDULER_STOPPED())
440 return (1);
441
442 tracker->rmp_flags = 0;
443 tracker->rmp_thread = td;
444 tracker->rmp_rmlock = rm;
445
446 if (rm->lock_object.lo_flags & LO_SLEEPABLE)
447 THREAD_NO_SLEEPING();
448
449 td->td_critnest++; /* critical_enter(); */
450
451 atomic_interrupt_fence();
452
453 pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */
454
455 rm_tracker_add(pc, tracker);
456
457 sched_pin();
458
459 atomic_interrupt_fence();
460
461 td->td_critnest--;
462
463 /*
464 * Fast path to combine two common conditions into a single
465 * conditional jump.
466 */
467 if (__predict_true(0 == (td->td_owepreempt |
468 CPU_ISSET(pc->pc_cpuid, &rm->rm_writecpus))))
469 return (1);
470
471 /* We do not have a read token and need to acquire one. */
472 return _rm_rlock_hard(rm, tracker, trylock);
473}
474
475static __noinline void
476_rm_unlock_hard(struct thread *td,struct rm_priotracker *tracker)

Callers 1

_rm_rlock_debugFunction · 0.70

Calls 3

rm_tracker_addFunction · 0.85
sched_pinFunction · 0.85
_rm_rlock_hardFunction · 0.85

Tested by

no test coverage detected