Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3622641imu; Mon, 28 Jan 2019 08:01:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN53umMsJnhDfhKBpWA4rLohgNqSwXPTZ6YefsdEhfizuzlbf+uJlilBv2cVxQQK1L/OhkWS X-Received: by 2002:a62:18ce:: with SMTP id 197mr23142708pfy.88.1548691279613; Mon, 28 Jan 2019 08:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691279; cv=none; d=google.com; s=arc-20160816; b=P12rPy3LoV1Yi4hkA3ikwN7JNp1ApslRVCJ3ptAiMP5t59q+61AsKDSJ3w85kCRLKI +KOMfkkBr3pl7ONLTIilRvbuggT/D0rAdxmyOO9rilI/78nCZtNOAkgu28otaOtNvMQ7 ZS6qZ9vMymLA7xlZX1yfOJLzRb9wHIqnd7jzzW8pNXNf1/Iz38MV0ttzAeN9eksfvY7n 94eX4PLHD/1gpXmRkSNvDPs/R62F/bYHRu07ZHCB+bqCFqUyVB91M4JDG4BRomF+MlYs b41PyzpO1DprJqo2KDS0DUrdjFj3mcK3AVxvaEQJtzPt/5Q7cCHW1kh4jcXVwX6LHJ7X S8og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ww6YAB7OuaXYmLLcUmOxlE3g99xJ1Rd14fjX8w3Kffg=; b=cDlEJFVOdrT79+HyCiGf/BSoFenBCvz0ENMQAnhkURr4b3hscdsXc382PRktmp+d/k Yf7yQ8i/y4DMQKp5cmzGsZ9Qs6EgH4eY4wQ7BSLj2v0RWY961G9xv3rXks6bsAivnk1R rS79uzxXkPNQLWslXOsRDXuGkr5Niq2XNf4DJE8Jkclg3YX69E9AUwHINKnevuaXW4m/ JJFQl2F2RzjA799p+/8TNuV4qb9Rp8YXty2xUUeqGbSMPPRY4zF6+Kc+RwpN1V1Y8q1a /o5z8IW7xncXxB3e+n5KbMWRilR6rr86fM0+QCl1OQWeeS3v3wj0dBOSDX7VGuGIqF4o cFGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Hjgoanzj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h17si1046242pgd.538.2019.01.28.08.01.03; Mon, 28 Jan 2019 08:01:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Hjgoanzj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730786AbfA1QAZ (ORCPT + 99 others); Mon, 28 Jan 2019 11:00:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:45646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730754AbfA1QAY (ORCPT ); Mon, 28 Jan 2019 11:00:24 -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 84FBA21848; Mon, 28 Jan 2019 16:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691224; bh=pDU80uKev68QP/nkK3SovFLybpwi/pkp4KcRb7JezDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hjgoanzj3O5mnvvbU+7EG7nLDEJkI9HTJrKRhE48/o+urH4il9A16qitOe7fgbs6N IcRNl9lYtFpf+62NbIHIZNwBIQg3MSEVMtUQSbjJjFMVbEI0gqhPHQZtiI0uX05tGC CzYzt5pq9u4+Qc2IHMjYp2235BhaTZ7kEbXRgpgE= 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.19 021/258] dlm: Don't swamp the CPU with callbacks queued during recovery Date: Mon, 28 Jan 2019 10:55:27 -0500 Message-Id: <20190128155924.51521-21-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-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