Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dlm: Don't swamp the CPU with callbacks queued during recovery

Before this patch, recovery would cause all callbacks to be delayed,
put on a queue, and afterward they were all queued to the callback
work queue. This patch does the same thing, but occasionally takes
a break after 25 of them so it won't swamp the CPU at the expense
of other RT processes like corosync.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Bob Peterson and committed by
David Teigland
216f0efd 9de30f3f

+10
+10
fs/dlm/ast.c
··· 292 292 flush_workqueue(ls->ls_callback_wq); 293 293 } 294 294 295 + #define MAX_CB_QUEUE 25 296 + 295 297 void dlm_callback_resume(struct dlm_ls *ls) 296 298 { 297 299 struct dlm_lkb *lkb, *safe; ··· 304 302 if (!ls->ls_callback_wq) 305 303 return; 306 304 305 + more: 307 306 mutex_lock(&ls->ls_cb_mutex); 308 307 list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) { 309 308 list_del_init(&lkb->lkb_cb_list); 310 309 queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); 311 310 count++; 311 + if (count == MAX_CB_QUEUE) 312 + break; 312 313 } 313 314 mutex_unlock(&ls->ls_cb_mutex); 314 315 315 316 if (count) 316 317 log_rinfo(ls, "dlm_callback_resume %d", count); 318 + if (count == MAX_CB_QUEUE) { 319 + count = 0; 320 + cond_resched(); 321 + goto more; 322 + } 317 323 } 318 324