Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3095225rwb; Mon, 15 Aug 2022 18:00:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR5lUzXkDsu9viW88hIkdCXcA9pl0r7of/Tqow584Ak2a8IG6R3QGODekSImMm6br9xCnBpy X-Received: by 2002:a17:907:6d8f:b0:730:b108:5062 with SMTP id sb15-20020a1709076d8f00b00730b1085062mr12066954ejc.461.1660611648149; Mon, 15 Aug 2022 18:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611648; cv=none; d=google.com; s=arc-20160816; b=fiUVp2fFerevBMnRexg1I6hecsjCFK0GeVX+LtNR8lJlSvTRiCNPk/+VVNkoNuxi2l 6JxBzyR70OA3POPQ/CBSzrekG9MXwSgtUr2R+4u7h+zAnGcv9ZoGioQtqV8Cug5elsjr 6T6/WIurqwn+oI23XMVeFvcm3t+qkbnu2N33P7up/ZObmqXutZS1dNzGwtmVw90KTTkA JzPOiH7r2RumIhuKN8VeuYT/TXuiYrvaxSPGtZOuYIvjQtkfLMqoTfWxWukYmyLcCCHi AONJLMe+Pc+JOczdFcRivA14nkr5sQLCCk3VeLxz39UJB3SXp34cW9vXY3gDCjL7jIN2 Ysvg== 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=c7fLc88AtED4d30UWW2YjCHE7PXClsxks8mSHB/BMEo=; b=JonQED01yIXUyqoaWj8cACrelgMkvrEL9s+UwVUTxnnySv32cAvBlyB9ElelVZKjb9 LaVlkhiJtxyVNqceQ44ZAmKvrkfhyHflg7NDWgZg/L2S/WZ/KwRErpyxTvdJlMdQlhUw NZaEo+zKiPcJaEiPfSPo2XhqC4wKKUHUzj6pMuxz6TOfbNQ4HheShXzYCxy2oujzs7Li 0alk0X4S1Js79jYIS2Y3g0XoCUdvq+tIGta9dm3mSXDRQGCijteIm4vzE32b4kb+Zvvf n2If6UyoZhUVgWWrMTBF8cmju//mKYZAWB6cJfHmPAlTfnZvYrD5QVBa4ydvWd6jNVys 0UyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zffe1L15; 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 sa25-20020a1709076d1900b0073069573e2esi8265381ejc.667.2022.08.15.18.00.22; Mon, 15 Aug 2022 18:00:48 -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=Zffe1L15; 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 S1346815AbiHPA5A (ORCPT + 99 others); Mon, 15 Aug 2022 20:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345775AbiHPAvD (ORCPT ); Mon, 15 Aug 2022 20:51:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED934B69F8; Mon, 15 Aug 2022 13:46:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id A88A3B81197; Mon, 15 Aug 2022 20:46:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D94D9C433C1; Mon, 15 Aug 2022 20:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596401; bh=xVQQgNRQH83af2R6Yq9bjg1K5EtMy1gWKh5F6Uvmb9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zffe1L15BIa2qg6M8fyKhfgb+G+xe7mpeeoP7gbgTgMmvEXhm0mr2KPemUeZVslR9 n+9FdaljlWHidOuEdOEzOX5u6ibAwgX7iVEw1zlEtDlGRkNSTovW4YPzZ7CMxJHCjy DQWmRyhZ19T+sOHlIxznetTN8dzxXEHL74MVvh08= 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.19 1068/1157] dm writecache: set a default MAX_WRITEBACK_JOBS Date: Mon, 15 Aug 2022 20:07:04 +0200 Message-Id: <20220815180522.830441037@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 d74c5a7a0ab4..d572135cd43f 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