| 431 | } |
| 432 | |
| 433 | int |
| 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 | |
| 475 | static __noinline void |
| 476 | _rm_unlock_hard(struct thread *td,struct rm_priotracker *tracker) |
no test coverage detected