From: Brian Behlendorf Date: Fri, 1 Apr 2011 00:07:12 +0000 (-0700) Subject: Fix inflated load average X-Git-Tag: zfs-0.6.0-rc3~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bfd214a;p=zfs 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 --- 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); }