Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2647848imj; Mon, 11 Feb 2019 06:26:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IZxuqI3C/B3aSCI2Za4EnYk7kb1yFI/tBNtnKqlyrXb+f1CJJm67q7hYrtE0bs3UbW0zEwB X-Received: by 2002:a63:e402:: with SMTP id a2mr980845pgi.182.1549895181274; Mon, 11 Feb 2019 06:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895181; cv=none; d=google.com; s=arc-20160816; b=F0qy3/xD/PsYkMkW9dGYXFIxN94ZcIPdbXJf8FTs7hhHo0nWRuB+clmTyy4dQyOTDx fveG8jN92a9+kQ42YhKFB7p3j0bwPWkClMrRYIcgajGvx4x6m38TeRhiYRXc7PyZEfYN lcdQRPNVr4sGwDw/xOan9z4FSR2t5C+MA4S/oFq2mSmo0SZyHZWdNHGyBGwciCpbwiyj goOAaojQloulQRL7341un59PMr/zLM7VEwsxyOYDK7U+N/v5YPPhxTsmqBNigWN2CLMP 3i05ozBR6xJBF0qZVTvPewrs01PVjHGoRtrkJHTZsiRQxgF2euADf2LAWWAWoUZjeM9E zUQg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N9HkO4o8tg+jximRAgVfj0o4ez+1/QUi+VwsS7rsvus=; b=zR8yFbVZ9lUc+wfljxYB0aFoOc/kaQIpyU5R18vUVtfUkxjAMcPD3g5qTtZ415KjjG DB2VyDJP8WqVTup3WSFnsrU0dyU+cUP5hKjkAkG5fNbFR/Jt8tmmXQCrgm4s1oJxZH5f Fx8a1zdecfvlB1FKs5RL3sFVrZN2gfJF1wvNpPITWBzYEWOcEJQgbG4bZrNvqWhnnRUW p9W5xO2MWMH2M0NJzfC+m00uqom2CQvSwQX+0jw7//sgcCa+xxPLcP5iZKqtKHrqIRjB XohdDiuYaanSJkvcDty+rLxECJ8IuEeGeXjd9PDRqJiYi+jPm2Cd/WT3ke29KgQdQZVs 8QlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K5zR97K6; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h85si10387083pfd.27.2019.02.11.06.26.05; Mon, 11 Feb 2019 06:26:21 -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=K5zR97K6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728548AbfBKOVf (ORCPT + 99 others); Mon, 11 Feb 2019 09:21:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:54368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728538AbfBKOVd (ORCPT ); Mon, 11 Feb 2019 09:21:33 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4776720844; Mon, 11 Feb 2019 14:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894892; bh=cDNJJ26H80M77tQBfTIWapZQjyd+uGenb9poKMS+IKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K5zR97K6I8JmNvLsqCjfypZuZ2px1pXb4pqQ1D7nKuEetE3CGUsBfZc3P9JDoNALf 40LE4I1BGI8csS6jTMCHVcdfITVhmRO6paPSuwdTXTu1aLTnb4rrG07y9KUgKeTAnc /Y4E1TCVVYUB7/5HnLbQhs6DUoMSuax1pVhSrnNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , David Teigland , Sasha Levin Subject: [PATCH 4.20 024/352] dlm: Dont swamp the CPU with callbacks queued during recovery Date: Mon, 11 Feb 2019 15:14:11 +0100 Message-Id: <20190211141847.889349511@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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