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

Function _rm_rlock_debug

freebsd/kern/kern_rmlock.c:633–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633int
634_rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
635 int trylock, const char *file, int line)
636{
637
638 if (SCHEDULER_STOPPED())
639 return (1);
640
641#ifdef INVARIANTS
642 if (!(rm->lock_object.lo_flags & LO_RECURSABLE) && !trylock) {
643 critical_enter();
644 KASSERT(rm_trackers_present(get_pcpu(), rm,
645 curthread) == 0,
646 ("rm_rlock: recursed on non-recursive rmlock %s @ %s:%d\n",
647 rm->lock_object.lo_name, file, line));
648 critical_exit();
649 }
650#endif
651 KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread),
652 ("rm_rlock() by idle thread %p on rmlock %s @ %s:%d",
653 curthread, rm->lock_object.lo_name, file, line));
654 KASSERT(!rm_destroyed(rm),
655 ("rm_rlock() of destroyed rmlock @ %s:%d", file, line));
656 if (!trylock) {
657 KASSERT(!rm_wowned(rm),
658 ("rm_rlock: wlock already held for %s @ %s:%d",
659 rm->lock_object.lo_name, file, line));
660 WITNESS_CHECKORDER(&rm->lock_object,
661 LOP_NEWORDER | LOP_NOSLEEP, file, line, NULL);
662 }
663
664 if (_rm_rlock(rm, tracker, trylock)) {
665 if (trylock)
666 LOCK_LOG_TRY("RMRLOCK", &rm->lock_object, 0, 1, file,
667 line);
668 else
669 LOCK_LOG_LOCK("RMRLOCK", &rm->lock_object, 0, 0, file,
670 line);
671 WITNESS_LOCK(&rm->lock_object, LOP_NOSLEEP, file, line);
672 TD_LOCKS_INC(curthread);
673 return (1);
674 } else if (trylock)
675 LOCK_LOG_TRY("RMRLOCK", &rm->lock_object, 0, 0, file, line);
676
677 return (0);
678}
679
680void
681_rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,

Callers

nothing calls this directly

Calls 6

rm_trackers_presentFunction · 0.85
get_pcpuFunction · 0.85
rm_wownedFunction · 0.70
_rm_rlockFunction · 0.70
critical_enterFunction · 0.50
critical_exitFunction · 0.50

Tested by

no test coverage detected