From patchwork Thu Oct 13 22:41:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Derrick X-Patchwork-Id: 87 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp512309wrs; Thu, 13 Oct 2022 15:45:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qBWGn/Fx+nknPf5cNMKlU0udW3x1q7qwvuu6X5JBb6jZFDW0728z1Qj9SPe5Jq2QI20Va X-Received: by 2002:a17:907:9602:b0:780:8c9f:f99a with SMTP id gb2-20020a170907960200b007808c9ff99amr1449218ejc.465.1665701142163; Thu, 13 Oct 2022 15:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665701142; cv=none; d=google.com; s=arc-20160816; b=kTk+R3cNhPzOgFDrtyTpUpAIHc2XrITiQvpZrlkFDlVr/qEhVPP3kA4QQAi/+ZUe0u 30SWmTNPVs2GBw2TWrnxOCwx15cbYswxaNYe5BYimjJWuaM0xfoykaulDAmuGMVx4D0P WOV6osu7gBw08ewkd4tj4dVJcJ1oOO4FBIdpbn/oKWBIE6LEztAtzH1kz05nkHehXyJu HQj+h39TD/khP6x0hi5+P9VFb25Ic4KcYzc17e5I2hEKdtgWVBM13v8fwaGmb5JCjzkN fqzK6syxrf9cTcESkCk46jt3ZpyWIv4M7n//CqEaUFDlbzixs+flTbvbm7gmCZgtR7/Y v2dA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=uV9jv29H6aFjQ0ZSoY1eBV2TaHPRxfvEQYTsQ4HbTmo=; b=TdRvVZTRHMGexqRvbrnpVdKPYWH3zrPGEF7u9sQhSfjdfYzgsPZwWelocPPxy2WaXu mR+4FLqorhbGUW6Ku95cB1D6jMiND/ulgMG3GMlJsrFu/PXDsyvoS3jR0ChFDPe3waDv mk+KhLXLNqCbR7YYbbRqqKdwZhoj8dOsTCDw0JmPSY4vA1CC8iTIVR9pJVFRwkmvD7gz sFy22PDuc/NIE6A67VRvNEchM1MIvuJ8a8ZaM9gYXGC/Ps5zDIqOZoofkt2XoCPu6WGt mCWH8QF2vhUDzoQnmYO7cFHskgI/jvaJsnFRjoRwgbMkDi1oNR45TVP70+WRuY5gzBno nr1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@comcastmailservice.net header.s=20211018a header.b=pkixH37i; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd43-20020a17090796ab00b0077f3a9c58e2si1159017ejc.6.2022.10.13.15.45.18; Thu, 13 Oct 2022 15:45:42 -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=@comcastmailservice.net header.s=20211018a header.b=pkixH37i; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbiJMWpH (ORCPT + 99 others); Thu, 13 Oct 2022 18:45:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbiJMWpE (ORCPT ); Thu, 13 Oct 2022 18:45:04 -0400 Received: from resqmta-c1p-023465.sys.comcast.net (resqmta-c1p-023465.sys.comcast.net [IPv6:2001:558:fd00:56::5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B46755F234 for ; Thu, 13 Oct 2022 15:44:56 -0700 (PDT) Received: from resomta-c1p-023267.sys.comcast.net ([96.102.18.232]) by resqmta-c1p-023465.sys.comcast.net with ESMTP id j2WSoDUqzf0y0j6uGoIgBW; Thu, 13 Oct 2022 22:42:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20211018a; t=1665700944; bh=uV9jv29H6aFjQ0ZSoY1eBV2TaHPRxfvEQYTsQ4HbTmo=; h=Received:Received:From:To:Subject:Date:Message-Id:MIME-Version; b=pkixH37in8eAtc+ANM7ONsju8O0nl69xc2fbW3o9jM11zq3Z4fkA0wCOI59y1/RCl Hpzt8pT/j8XmFzjczzffsJuYoiHEVK4gI3mMJ64PS1rkHq1mQ7WLlb0Jq8XfqcuWDB eMKgePlLoZP+aPHhm7Z7pW/IMg0oo4BKcP2bqGh3V8xbPwqQMmVBNltvrIUWeik2mU Wf9zXB1kEkRmtl5YdVH0qLGIbwSdV/aEjH4bDCLl/aMNV9u4pploA3xOd0WhDegXeU xna7IeSPPhE5P2rQd6e/N0o+gw5F/aWYPndf9oJk8dmmcfb9xGWcL7DWrMFYVr+DgX krdoBC0fbd4gw== Received: from jderrick-mobl4.amr.corp.intel.com ([71.205.181.50]) by resomta-c1p-023267.sys.comcast.net with ESMTPA id j6toofOVmA6uYj6ttozg6o; Thu, 13 Oct 2022 22:42:02 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekuddgudefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomheplfhonhgrthhhrghnucffvghrrhhitghkuceojhhonhgrthhhrghnrdguvghrrhhitghksehlihhnuhigrdguvghvqeenucggtffrrghtthgvrhhnpedvtdejiefgueelteevudevhfdvjedvhfdtgfehjeeitdevueektdegtedttdehvdenucfkphepjedurddvtdehrddukedurdehtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehjuggvrhhrihgtkhdqmhhosghlgedrrghmrhdrtghorhhprdhinhhtvghlrdgtohhmpdhinhgvthepjedurddvtdehrddukedurdehtddpmhgrihhlfhhrohhmpehjohhnrghthhgrnhdruggvrhhrihgtkheslhhinhhugidruggvvhdpnhgspghrtghpthhtohepjedprhgtphhtthhopehsohhngheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrhgrihgusehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepjhhonhgrthhhrghnrdguvghrrhhitghksehsoh hlihguihhgmhdrtghomhdprhgtphhtthhopehjohhnrghthhgrnhigrdhskhdruggvrhhrihgtkhesihhnthgvlhdrtghomhdprhgtphhtthhopehmrghrihhushiirdhtkhgrtgiihihksehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepjhhonhgrthhhrghnrdguvghrrhhitghksehlihhnuhigrdguvghv X-Xfinity-VMeta: sc=-100.00;st=legit From: Jonathan Derrick To: Song Liu Cc: , , jonathan.derrick@solidigm.com, jonathanx.sk.derrick@intel.com, Mariusz Tkaczyk , Jonathan Derrick Subject: [PATCH v2 0/3] Bitmap percentage flushing Date: Thu, 13 Oct 2022 16:41:48 -0600 Message-Id: <20221013224151.300-1-jonathan.derrick@linux.dev> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746614241090995667?= X-GMAIL-MSGID: =?utf-8?q?1746614241090995667?= This introduces a percentage-flushing mechanism that works in-tandem to the mdadm delay timer. The percentage argument is based on the number of chunks dirty (rather than percentage), due to large drives requiring smaller and smaller percentages (eg, 32TB drives-> 1% is 320GB). This set hopes to provide a way to make the bitmap flushing more consistent. It was observed that a synchronous, random write qd1 workload, could make bitmap writes easily become almost half of the I/O. And in similar workloads with different timing, it was several minutes between bitmap updates. This is too inconsistent to be reliable. This first and second patches adds the flush_threshold parameter. The default value of 0 defines the default behavior: unplugging immediately just as before. With a flush-threshold value of 1, it becomes more consistent and paranoid, flushing on nearly every I/O, leading to a 40% or greater situation. From there, the flush_threshold can be defined higher for those situations where power loss is rare and full resync can be tolerated. The third patch converts the daemon worker to an actual timer. This makes it more consistent and removes some ugly code. Jonathan Derrick (3): md/bitmap: Add chunk-threshold unplugging md/bitmap: Add sysfs interface for flush threshold md/bitmap: Convert daemon_work to proper timer Documentation/admin-guide/md.rst | 5 ++ drivers/md/md-bitmap.c | 98 +++++++++++++++++++++++++------- drivers/md/md-bitmap.h | 4 +- drivers/md/md.c | 9 ++- drivers/md/md.h | 2 + 5 files changed, 93 insertions(+), 25 deletions(-)