]> granicus.if.org Git - zfs/commitdiff
Fix inflated load average
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 1 Apr 2011 00:07:12 +0000 (17:07 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 1 Apr 2011 00:07:12 +0000 (17:07 -0700)
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

index 5afb139ddfb0b87710bd2805326acf06ad0943a8..00c1c7d26abe64dbf96d27ececd1be5d8f542817 100644 (file)
@@ -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);
 }