From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DD1DC282CD for ; Mon, 28 Jan 2019 15:44:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34E562173C for ; Mon, 28 Jan 2019 15:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548690276; bh=pDU80uKev68QP/nkK3SovFLybpwi/pkp4KcRb7JezDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HnbFPa+28IiYoKtwtorU/xiUhI23QmcSNgDhITiUBsTHjy43Kp6JfXWbLOapF3SEK pIImVKH1aN1VsiRZwoGs/vMzo4PF5QsUtb/WIgEliuvg0canCCY2mQCEIPCih+7A1J /IcQ6E03oNQSVHPLyREW/C8piQvbd1o7gUcVpHr4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727403AbfA1Poe (ORCPT ); Mon, 28 Jan 2019 10:44:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:57774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727365AbfA1Po2 (ORCPT ); Mon, 28 Jan 2019 10:44:28 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 835B620880; Mon, 28 Jan 2019 15:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548690268; bh=pDU80uKev68QP/nkK3SovFLybpwi/pkp4KcRb7JezDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Orc0y8v6IFsvjoJ4nse5ofdusJ2YQInyTkAcz8dO6Kuw0p99vMzkjV4pqfMbLD2C6 vv9R+BPR742pyQr7v+2jajZktWWIbTippdxoXZYar1sTM/ZFWw692JhRwd0SuvuXaJ xMsy4ySsIUU684Ee9ZQPAO9LvjOBAMADoqv8oTnY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bob Peterson , David Teigland , Sasha Levin , cluster-devel@redhat.com Subject: [PATCH AUTOSEL 4.20 025/304] dlm: Don't swamp the CPU with callbacks queued during recovery Date: Mon, 28 Jan 2019 10:39:02 -0500 Message-Id: <20190128154341.47195-25-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128154341.47195-1-sashal@kernel.org> References: <20190128154341.47195-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bob Peterson [ Upstream commit 216f0efd19b9cc32207934fd1b87a45f2c4c593e ] 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 Signed-off-by: David Teigland Signed-off-by: Sasha Levin --- fs/dlm/ast.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index 562fa8c3edff..47ee66d70109 100644 --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c @@ -292,6 +292,8 @@ void dlm_callback_suspend(struct dlm_ls *ls) flush_workqueue(ls->ls_callback_wq); } +#define MAX_CB_QUEUE 25 + void dlm_callback_resume(struct dlm_ls *ls) { struct dlm_lkb *lkb, *safe; @@ -302,15 +304,23 @@ void dlm_callback_resume(struct dlm_ls *ls) if (!ls->ls_callback_wq) return; +more: mutex_lock(&ls->ls_cb_mutex); list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) { list_del_init(&lkb->lkb_cb_list); queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); count++; + if (count == MAX_CB_QUEUE) + break; } mutex_unlock(&ls->ls_cb_mutex); if (count) log_rinfo(ls, "dlm_callback_resume %d", count); + if (count == MAX_CB_QUEUE) { + count = 0; + cond_resched(); + goto more; + } } -- 2.19.1