Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088795rwb; Mon, 15 Aug 2022 17:51:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR4fjClbP0HmjbxQ+KTIjKQjNzjzQd3Pl2V9EdZq/Oa56tZ3IxJSik/XsPaUNPH9nRJEzxaa X-Received: by 2002:a17:906:8a42:b0:730:92dc:a831 with SMTP id gx2-20020a1709068a4200b0073092dca831mr11803485ejc.481.1660611077782; Mon, 15 Aug 2022 17:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611077; cv=none; d=google.com; s=arc-20160816; b=oBkCbvVjzyHNMim/XoVYoFGR5ZmS9sKGKXSg7AVtLMksftcLg7MyHgkHv11ujc1QU0 gXTTyc9+CziZFfwFoQ5PUE0TPROlXgCPk4YwH0QxfwZbLZ4s9VgLz86OA+J8gIED62uY jm3eNv4iBV00osu2ywRhUv/eOWxBxPglEXO57WnrUdQcwYFpd8zSijVPybhURlwXycjd g0Cbr6P9QBQjrSuunqzhUsOdBq9E2qeWhkNYdiAUBCqmP2lVklqrn5//RtwxSNsR1paI qilDEakgQoOjhTj0SoEvbBjvdiQgzfydgbtFzIY6wFSJjTOk5N8pavy0l/pqeKN5To3p Apdg== 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=rvQ9bJfosvVW8HAG1adbp2HK52hnvDW/vR6AjuXMFVc=; b=v18xXF6ESfvQVjs5//t7lCIqwsx9DfFVPKGfdILDMlid1IAGFSgxIKmaFrQrUJ0DFU BPoxndshWytmRVKQGhqAtpZASOsB/6p8Tk2F4MT6jrgMfnZt4A2XL8kSanREOTX9evST p6E83IT5zkvI4rYwjWDv/fB+WV4+ov+4HAkUaQGNFWEV7vG10LK25LFG24tfZqYX/mLv o6JqtgUyY4JSDV314U/Xt0m0EU82IUKdOryg7i1VYfG0LBmOFNfuO94sTn81cZ2/emZx JAmp1OUQtqHCmRSmOKhqSHYdtd/gQneFZojkdY8RRjqSmVFadoE+JAEhHIP4sCOl68Fz PVAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eDCyAGOQ; 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 o24-20020a1709061d5800b00731868bc6e8si8106884ejh.58.2022.08.15.17.50.51; Mon, 15 Aug 2022 17:51:17 -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=eDCyAGOQ; 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 S239432AbiHOXTN (ORCPT + 99 others); Mon, 15 Aug 2022 19:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348202AbiHOXPg (ORCPT ); Mon, 15 Aug 2022 19:15:36 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40C79D64A; Mon, 15 Aug 2022 13:02:37 -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 57B73CE12E8; Mon, 15 Aug 2022 20:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ABA8C433C1; Mon, 15 Aug 2022 20:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593754; bh=+skbTRi2GS+5nB4ubqEygyjM5jHzwVEmhibFxuKJtwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDCyAGOQ8h7YpX4452KEQ/6QPMxXkaUjEHJNoAM8AVce88p2g8femmF5IXpCuXRx0 n5pyPftgSm+5i/DQxlc//cmvXHEVdzRmUrqfT3yURqKehazWQdVUNcWD125WLVL5/Q q325L3J+Egro83eg228NvwdSl0GtdAK/I7ugBN/s= 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.18 1001/1095] dm writecache: set a default MAX_WRITEBACK_JOBS Date: Mon, 15 Aug 2022 20:06:40 +0200 Message-Id: <20220815180510.528171361@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 e5acb393f70b..27557b852c94 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