Whamcloud - gitweb
LU-8307 ldlm: cond_resched in ldlm_bl_thread_main
[fs/lustre-release.git] / lustre / ldlm / ldlm_lockd.c
index 651eebe..b29b721 100644 (file)
@@ -2767,6 +2767,11 @@ static int ldlm_bl_thread_main(void *arg)
 
                if (rc == LDLM_ITER_STOP)
                        break;
 
                if (rc == LDLM_ITER_STOP)
                        break;
+
+               /* If there are many namespaces, we will not sleep waiting for
+                * work, and must do a cond_resched to avoid holding the CPU
+                * for too long */
+               cond_resched();
        }
 
        atomic_dec(&blp->blp_num_threads);
        }
 
        atomic_dec(&blp->blp_num_threads);