* bufspace_daemon_wait: * * Sleep until the domain falls below a limit or one second passes. */
| 633 | * Sleep until the domain falls below a limit or one second passes. |
| 634 | */ |
| 635 | static void |
| 636 | bufspace_daemon_wait(struct bufdomain *bd) |
| 637 | { |
| 638 | /* |
| 639 | * Re-check our limits and sleep. bd_running must be |
| 640 | * cleared prior to checking the limits to avoid missed |
| 641 | * wakeups. The waker will adjust one of bufspace or |
| 642 | * freebuffers prior to checking bd_running. |
| 643 | */ |
| 644 | BD_RUN_LOCK(bd); |
| 645 | atomic_store_int(&bd->bd_running, 0); |
| 646 | if (bd->bd_bufspace < bd->bd_bufspacethresh && |
| 647 | bd->bd_freebuffers > bd->bd_lofreebuffers) { |
| 648 | msleep(&bd->bd_running, BD_RUN_LOCKPTR(bd), PRIBIO|PDROP, |
| 649 | "-", hz); |
| 650 | } else { |
| 651 | /* Avoid spurious wakeups while running. */ |
| 652 | atomic_store_int(&bd->bd_running, 1); |
| 653 | BD_RUN_UNLOCK(bd); |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | /* |
| 658 | * bufspace_adjust: |