X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fldlm%2Fldlm_lockd.c;h=2be5aa90abd3371b4ce89ac4e81bf19ed9c7f304;hp=da9a6f76a8afafe7080a4d1f30c2893d801b49d8;hb=3551b2cc2bbb3181bbb2afc8675cb3457215f4f5;hpb=6f57184f83dc983eded15052d434e7856a7de92e diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index da9a6f7..2be5aa9 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -2230,33 +2230,31 @@ static int ldlm_bl_thread_main(void *arg) while (1) { struct l_wait_info lwi = { 0 }; struct ldlm_bl_work_item *blwi = NULL; + int busy; blwi = ldlm_bl_get_work(blp); if (blwi == NULL) { - int busy; - cfs_atomic_dec(&blp->blp_busy_threads); l_wait_event_exclusive(blp->blp_waitq, (blwi = ldlm_bl_get_work(blp)) != NULL, &lwi); busy = cfs_atomic_inc_return(&blp->blp_busy_threads); - - if (blwi->blwi_ns == NULL) - /* added by ldlm_cleanup() */ - break; - - /* Not fatal if racy and have a few too many threads */ - if (unlikely(busy < blp->blp_max_threads && - busy >= cfs_atomic_read(&blp->blp_num_threads) && - !blwi->blwi_mem_pressure)) - /* discard the return value, we tried */ - ldlm_bl_thread_start(blp); } else { - if (blwi->blwi_ns == NULL) - /* added by ldlm_cleanup() */ - break; + busy = cfs_atomic_read(&blp->blp_busy_threads); } + + if (blwi->blwi_ns == NULL) + /* added by ldlm_cleanup() */ + break; + + /* Not fatal if racy and have a few too many threads */ + if (unlikely(busy < blp->blp_max_threads && + busy >= cfs_atomic_read(&blp->blp_num_threads) && + !blwi->blwi_mem_pressure)) + /* discard the return value, we tried */ + ldlm_bl_thread_start(blp); + if (blwi->blwi_mem_pressure) cfs_memory_pressure_set();