Skip to content

Commit 216f0ef

Browse files
AstralBobteigland
authored andcommitted
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>
1 parent 9de30f3 commit 216f0ef

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎fs/dlm/ast.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ void dlm_callback_suspend(struct dlm_ls *ls)
292292
flush_workqueue(ls->ls_callback_wq);
293293
}
294294

295+
#define MAX_CB_QUEUE 25
296+
295297
void dlm_callback_resume(struct dlm_ls *ls)
296298
{
297299
struct dlm_lkb *lkb, *safe;
@@ -302,15 +304,23 @@ void dlm_callback_resume(struct dlm_ls *ls)
302304
if (!ls->ls_callback_wq)
303305
return;
304306

307+
more:
305308
mutex_lock(&ls->ls_cb_mutex);
306309
list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) {
307310
list_del_init(&lkb->lkb_cb_list);
308311
queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work);
309312
count++;
313+
if (count == MAX_CB_QUEUE)
314+
break;
310315
}
311316
mutex_unlock(&ls->ls_cb_mutex);
312317

313318
if (count)
314319
log_rinfo(ls, "dlm_callback_resume %d", count);
320+
if (count == MAX_CB_QUEUE) {
321+
count = 0;
322+
cond_resched();
323+
goto more;
324+
}
315325
}
316326

0 commit comments

Comments
 (0)