From bfd214af01dd360417b1331d903655244979fe0f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 31 Mar 2011 17:07:12 -0700 Subject: [PATCH] Fix inflated load average Kernel threads which sleep uninterruptibly on Linux are marked in the (D) state. These threads are usually in the process of performing IO and are thus counted against the load average. The txg_quiesce and txg_sync threads were always sleeping uninterruptibly and thus inflating the load average. This change makes them sleep interruptibly. Some care is required however because these threads may now be woken early by signals. In this case the callers are all careful to check that the required conditions are met after waking up. If we're woken early due to a signal they will simply go back to sleep. In this case these changes are safe. Closes #175 --- module/zfs/txg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/zfs/txg.c b/module/zfs/txg.c index 5afb139dd..00c1c7d26 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -166,10 +166,10 @@ txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, uint64_t time) CALLB_CPR_SAFE_BEGIN(cpr); if (time) - (void) cv_timedwait(cv, &tx->tx_sync_lock, + (void) cv_timedwait_interruptible(cv, &tx->tx_sync_lock, ddi_get_lbolt() + time); else - cv_wait(cv, &tx->tx_sync_lock); + cv_wait_interruptible(cv, &tx->tx_sync_lock); CALLB_CPR_SAFE_END(cpr, &tx->tx_sync_lock); } -- 2.40.0