Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2886725rwb; Mon, 15 Aug 2022 13:19:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6DIhcOKDd/MQdsztNom2WrTWen7zZDr4eCHYsCgpj6dpnuLijzlUJs5AixGEPGgurgi//e X-Received: by 2002:a05:6402:2751:b0:443:d90a:43d4 with SMTP id z17-20020a056402275100b00443d90a43d4mr4062692edd.368.1660594768994; Mon, 15 Aug 2022 13:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594768; cv=none; d=google.com; s=arc-20160816; b=NjtCi+WyUJIsue0axg28L49L73aYw/8P34r9BLt+nxAzcESjeBCtUmERiAgexQoWQB MyrSdEulyXxvOtssih0CD+JpcA4Jf7QfqdFsni33m0QJNe8sw9u+Aty3U2OroO3PW1Oh O4GBJnc57yx9d2gLHeCCG4PSPc6Rq/40+L17dtMFbJF5mdSokp3MLd6qCMuwRCRnbcAB dCHWO4wwLnXdz61y3adaAT1uHFPl9ywzAsgi2HvMEKSVvqTSoy4OxqNkF7j03UyBNiNG u9yZQ4QMpPyM7SESOPdj1k1VsU/O2sbJQFAwHFFNiAwOmQO/Q+Apv74AUiUpyIbyOKa3 nq9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QMl+36fqUGHKhnfVwixY1hx7um4UnTbDAYn7nqA1JuU=; b=Z+GrTt05u/QiM30GkZOPuQmWx42FUgEUShUvB2QXu/zy79SZbEU1zGI12N/oo0e9ez Qvcd1SQmXTiMoK8DbU9GiGj4wz6IKcsttukNzoSrlX0XH6wq0PGtpzQmd2jhwD/UzrVq r3fMjs1MdvoG9t1n6cS95hGI5KjmdnzmCT2V/F2lZdZRxFKqoQSO+Rlm8T34dxLE1TAN opuS9dNcYRkAXGHa8b4DhjCIv8LKjwAfNLhuaoS8TeJWxehCGiEl4eVW4Xbc9cHoqMug JcWbtMsZGRkuARCLZt9fJxofUkVHX1pOM7ec2fhYeVgUwX2mZECi3RESnVRIUVD88ezc j5cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gnpZpXXO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg38-20020a170907a42600b0072b6d7a0119si4756044ejc.305.2022.08.15.13.19.02; Mon, 15 Aug 2022 13:19:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gnpZpXXO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345321AbiHOTx3 (ORCPT + 99 others); Mon, 15 Aug 2022 15:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240661AbiHOTwN (ORCPT ); Mon, 15 Aug 2022 15:52:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 578DA101E6; Mon, 15 Aug 2022 11:50:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 48DDBCE1279; Mon, 15 Aug 2022 18:50:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE86CC433C1; Mon, 15 Aug 2022 18:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589440; bh=rDVCFEShSGxdUo+XdGyKcO4VNAALXJshOd6PFfNegSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnpZpXXOsydabcUO+iw1zONhNZrvZw2KOeYk4ASKWnZNGbJVoCFgGUyism/sqc26W iEilsY5QNmU8kuOpYPkX6WocgN+GROH5bLxzjozu2agpd0lh9Bz4ERcS6XCaMV1C7f 8AK4M2ciCbSCZ1pFZABEkYwNlZYduIrb0WS4OAuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 718/779] dm writecache: set a default MAX_WRITEBACK_JOBS Date: Mon, 15 Aug 2022 20:06:02 +0200 Message-Id: <20220815180408.148101902@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka [ Upstream commit ca7dc242e358e46d963b32f9d9dd829785a9e957 ] dm-writecache has the capability to limit the number of writeback jobs in progress. However, this feature was off by default. As such there were some out-of-memory crashes observed when lowering the low watermark while the cache is full. This commit enables writeback limit by default. It is set to 256MiB or 1/16 of total system memory, whichever is smaller. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-writecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index c3e59d8af76f..dfb55fe09ce1 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -22,7 +22,7 @@ #define HIGH_WATERMARK 50 #define LOW_WATERMARK 45 -#define MAX_WRITEBACK_JOBS 0 +#define MAX_WRITEBACK_JOBS min(0x10000000 / PAGE_SIZE, totalram_pages() / 16) #define ENDIO_LATENCY 16 #define WRITEBACK_LATENCY 64 #define AUTOCOMMIT_BLOCKS_SSD 65536 -- 2.35.1