| 546 | } |
| 547 | |
| 548 | static bool |
| 549 | lockmgr_slock_adaptive(struct lock_delay_arg *lda, struct lock *lk, uintptr_t *xp, |
| 550 | int flags) |
| 551 | { |
| 552 | struct thread *owner; |
| 553 | uintptr_t x; |
| 554 | |
| 555 | x = *xp; |
| 556 | MPASS(x != LK_UNLOCKED); |
| 557 | owner = (struct thread *)LK_HOLDER(x); |
| 558 | for (;;) { |
| 559 | MPASS(owner != curthread); |
| 560 | if (owner == (struct thread *)LK_KERNPROC) |
| 561 | return (false); |
| 562 | if ((x & LK_SHARE) && LK_SHARERS(x) > 0) |
| 563 | return (false); |
| 564 | if (owner == NULL) |
| 565 | return (false); |
| 566 | if (!TD_IS_RUNNING(owner)) |
| 567 | return (false); |
| 568 | if ((x & LK_ALL_WAITERS) != 0) |
| 569 | return (false); |
| 570 | lock_delay(lda); |
| 571 | x = lockmgr_read_value(lk); |
| 572 | if (LK_CAN_SHARE(x, flags, false)) { |
| 573 | *xp = x; |
| 574 | return (true); |
| 575 | } |
| 576 | owner = (struct thread *)LK_HOLDER(x); |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | static __noinline int |
| 581 | lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, |
no test coverage detected