From patchwork Tue Oct 11 01:00:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B15C433F5 for ; Tue, 11 Oct 2022 01:01:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 793E76B0073; Mon, 10 Oct 2022 21:01:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 743B86B0074; Mon, 10 Oct 2022 21:01:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6334D6B0075; Mon, 10 Oct 2022 21:01:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4FC6D6B0073 for ; Mon, 10 Oct 2022 21:01:18 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2EE0FC0FFC for ; Tue, 11 Oct 2022 01:01:18 +0000 (UTC) X-FDA: 80006865036.30.26487B9 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf10.hostedemail.com (Postfix) with ESMTP id CBB06C0019 for ; Tue, 11 Oct 2022 01:01:17 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id E675C34BDDCF; Mon, 10 Oct 2022 18:01:05 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 01/14] mm: add bdi_set_strict_limit() function Date: Mon, 10 Oct 2022 18:00:31 -0700 Message-Id: <20221011010044.851537-2-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450077; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d/iFoe1bt1NpYx+Au3tv9hTFtJHOJTfblPbH7ptRjB8=; b=sdxo8YSOhiUM/JAIi7t4YPEAIxdbzym3wlq2R4xRdIqISpp7wRneXX56lp8DrbPpDc+dXg 8WBOI94WV/3qgCakLOxPz5Fuc8hWnueZdTDR3xiSgFBt5cSNiUhxBzlKvjHaL9DFFkSEi+ SXK95wvEssLz1BOqli8YDoKrBK4cLyk= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf10.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450077; a=rsa-sha256; cv=none; b=b2mNYWmLZs+KmRRmWwp+3lvH8UZEKcvEppK3cQdOC94qLQjdxSwEdFNlUJPckSRWbYbfA/ PMpptZ6B5QA/EkTxHWtcOTqu8pUjKS4zLPAa1hV1ppF4CvYbL3XMfOS5RyckSrpaqmafmN 1RPxa8zIjgIlFkxEupF7ea/zzvdFbOU= Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf10.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io X-Stat-Signature: pshzgx78twigqnpa4wn7mxh4m71p4wem X-Rspamd-Queue-Id: CBB06C0019 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1665450077-499746 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This adds the bdi_set_strict_limit function to be able to set/unset the BDI_CAP_STRICTLIMIT flag. Signed-off-by: Stefan Roesch --- include/linux/backing-dev.h | 1 + mm/page-writeback.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 439815cc1ab9..9c984ffc8a0a 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -104,6 +104,7 @@ static inline unsigned long wb_stat_error(void) int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); +int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit); /* * Flags in backing_dev_info::capability diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 7e9d8d857ecc..e22aae0ecacd 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -698,6 +698,22 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) } EXPORT_SYMBOL(bdi_set_max_ratio); +int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit) +{ + if (strict_limit > 1) + return -EINVAL; + + spin_lock_bh(&bdi_lock); + if (strict_limit) + bdi->capabilities |= BDI_CAP_STRICTLIMIT; + else + bdi->capabilities &= ~BDI_CAP_STRICTLIMIT; + spin_unlock_bh(&bdi_lock); + + return 0; +} +EXPORT_SYMBOL_GPL(bdi_set_strict_limit); + static unsigned long dirty_freerun_ceiling(unsigned long thresh, unsigned long bg_thresh) { From patchwork Tue Oct 11 01:00:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD1B4C433F5 for ; Tue, 11 Oct 2022 01:01:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 580006B0075; Mon, 10 Oct 2022 21:01:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FEC28E0001; Mon, 10 Oct 2022 21:01:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D6678E0003; Mon, 10 Oct 2022 21:01:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 19BCC8E0002 for ; Mon, 10 Oct 2022 21:01:20 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D8D0940F8C for ; Tue, 11 Oct 2022 01:01:19 +0000 (UTC) X-FDA: 80006865078.16.E34567C Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf09.hostedemail.com (Postfix) with ESMTP id 75EEF140025 for ; Tue, 11 Oct 2022 01:01:19 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id EC6BD34BDDD2; Mon, 10 Oct 2022 18:01:05 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 02/14] mm: Add new knob /sys/class/bdi//strict_limit Date: Mon, 10 Oct 2022 18:00:32 -0700 Message-Id: <20221011010044.851537-3-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450079; a=rsa-sha256; cv=none; b=SOEf88wM4ym8v+8vYusmOxqnjFRTZX1TBVZMcf7AhUdo0BhXQk4vgxOe67WykCbc9JF42+ qXwkKAV/Ey8E5dIgR/TSMxK5+ER5psW+3rTX9EVfMA8Gw3+JZr9tFB6XcZ3Zye3ApkC0Kp opoq7CZJGa9vNlK8vLwWTfZhn2ToEPs= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=neutral (imf09.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450079; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGZdKbeEWglLon1ji1xCOGLZx125v38HfU6neXGyf7U=; b=p1kGn8LR7d5crqm4ULI43Grba2ApUgpU1F1xsHM1lrJBq06ug9mxwTSDKd4T51FaBMLdkK 60Vm8/WY9EevBEZVi0tVlvyhxVF4z1ELG6+U80USGr+cbfGdv1Dy6j+Y2MosnJeoP/ftVc ZaShwFMngetZAlGGRxUxXW6EUDwHluA= Authentication-Results: imf09.hostedemail.com; dkim=none; spf=neutral (imf09.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-Stat-Signature: 89echemur3qhbukbwjimjbkd9kwjftaq X-Rspamd-Queue-Id: 75EEF140025 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1665450079-497579 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add a new knob to /sys/class/bdi//strict_limit. This new knob allows to set/unset the flag BDI_CAP_STRICTLIMIT in the bdi capabilities. Signed-off-by: Stefan Roesch --- mm/backing-dev.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mm/backing-dev.c b/mm/backing-dev.c index de65cb1e5f76..f9aaa14ad98f 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -209,11 +209,40 @@ static ssize_t stable_pages_required_show(struct device *dev, } static DEVICE_ATTR_RO(stable_pages_required); +static ssize_t strict_limit_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct backing_dev_info *bdi = dev_get_drvdata(dev); + unsigned int strict_limit; + ssize_t ret; + + ret = kstrtouint(buf, 10, &strict_limit); + if (ret < 0) + return ret; + + ret = bdi_set_strict_limit(bdi, strict_limit); + if (!ret) + ret = count; + + return ret; +} + +static ssize_t strict_limit_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct backing_dev_info *bdi = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", + !!(bdi->capabilities & BDI_CAP_STRICTLIMIT)); +} +static DEVICE_ATTR_RW(strict_limit); + static struct attribute *bdi_dev_attrs[] = { &dev_attr_read_ahead_kb.attr, &dev_attr_min_ratio.attr, &dev_attr_max_ratio.attr, &dev_attr_stable_pages_required.attr, + &dev_attr_strict_limit.attr, NULL, }; ATTRIBUTE_GROUPS(bdi_dev); From patchwork Tue Oct 11 01:00:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30E0DC4332F for ; Tue, 11 Oct 2022 01:01:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 66A878E0001; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EAAE900003; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2133E8E0001; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EA3946B007E for ; Mon, 10 Oct 2022 21:01:22 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BC00E1C11FD for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) X-FDA: 80006865204.03.DF0DAF2 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf06.hostedemail.com (Postfix) with ESMTP id 51BBB18001E for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id F21E234BDDD4; Mon, 10 Oct 2022 18:01:05 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 03/14] mm: document new /sys/class/bdi//strict_limit knob Date: Mon, 10 Oct 2022 18:00:33 -0700 Message-Id: <20221011010044.851537-4-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450082; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2U+im8+B4wNoFjJqOFLX/rTYATi3Lg6oskSy2dhLr2A=; b=L4BFLGPsrGNUlpHo4H6rPjV2hbbmB+826O1DKa+6A/VHyje8Co9ALcHg1I8tgIwSw1r0MU YMrdj1gAsgq/S6FbaaQEN8Ru14Shh2BXfKePi/qdlMWeUwZTitHDAGD4gyIkuI6S9RecEd 7MZQypKQUu70mcIemlkQJ0wBqqL7CZ0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=neutral (imf06.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450082; a=rsa-sha256; cv=none; b=A2kyD/dUz9Z7x5FEAer+hG8WTnGC5Py26LvnWoKU9ft3u06P3jm7XOJU5ZRrQgPUFTGhGa SGxiDlATleeqbKGGHT8ZuOoeC35i2UEZqJaNpGyn+C/R7sSTdpgakixvwtRt7FtpbIGEft P4d1yoqAQM3T9KkqtPDj75a3GBRESB4= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 51BBB18001E X-Stat-Signature: 9wkgd5wm9khq9xrqcy8tozm8k4i7zttg Authentication-Results: imf06.hostedemail.com; dkim=none; spf=neutral (imf06.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-HE-Tag: 1665450082-903975 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This documents the new /sys/class/bdi//strict_limit knob. Signed-off-by: Stefan Roesch --- Documentation/ABI/testing/sysfs-class-bdi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-bdi b/Documentation/ABI/testing/sysfs-class-bdi index 6d2a2fc189dd..68b5d4018c2f 100644 --- a/Documentation/ABI/testing/sysfs-class-bdi +++ b/Documentation/ABI/testing/sysfs-class-bdi @@ -55,6 +55,17 @@ Description: mount that is prone to get stuck, or a FUSE mount which cannot be trusted to play fair. + (read-write) +What: /sys/class/bdi//strict_limit +Date: October 2022 +Contact: Stefan Roesch +Description: + Forces per-BDI checks for the share of given device in the write-back + cache even before the global background dirty limit is reached. This + is useful in situations where the global limit is much higher than + affordable for given relatively slow (or untrusted) device. Turning + strictlimit on has no visible effect if max_ratio is equal to 100%. + (read-write) What: /sys/class/bdi//stable_pages_required Date: January 2008 From patchwork Tue Oct 11 01:00:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003478 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4067C433FE for ; Tue, 11 Oct 2022 01:01:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34DDD6B0078; Mon, 10 Oct 2022 21:01:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 326006B0075; Mon, 10 Oct 2022 21:01:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1532F8E0001; Mon, 10 Oct 2022 21:01:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 00B326B0075 for ; Mon, 10 Oct 2022 21:01:19 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CDD621C6264 for ; Tue, 11 Oct 2022 01:01:19 +0000 (UTC) X-FDA: 80006865078.11.39574F0 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf12.hostedemail.com (Postfix) with ESMTP id 623B440020 for ; Tue, 11 Oct 2022 01:01:19 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 03A3A34BDDD6; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 04/14] mm: Use part per 10000 for bdi ratios. Date: Mon, 10 Oct 2022 18:00:34 -0700 Message-Id: <20221011010044.851537-5-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450079; a=rsa-sha256; cv=none; b=Bo4Or91kLpGwAyAiKPHyMUIrylkpFwZ/d94bkOzlzOD3wOI7z7oTE/L9WUHeQTFqlK20NC HldquRW6k+gz2ZBhg0vEzKrj4EaFKWC5OVKrxI9/vnvId8eL+1wZ/LjglF3VLoJ1rLyDd7 x1d8k07YeS2oQk06XbH3n6XYxSb8bn8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=neutral (imf12.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450079; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W8IYwB333sjky2c2+5pyHNPQ63AnO4y3dd6FNlJ0stI=; b=Px4h0Fm/cmlkHrH6/wnh+0xNfzKa331locjDzWk6QCrcUPhdsllf0WJ43RBwawzj5kBfgt wjmYDDKerUSwLtqLEDXGYe42whA+oIYHdR1WNrx7TJ5cZ/wUlk7c3tG4q3yTsSekNjkXvp LWZeKEzw/STKA4ZD7nxqzYttDvqBwTU= Authentication-Results: imf12.hostedemail.com; dkim=none; spf=neutral (imf12.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-Stat-Signature: cs8doa6os34nsat7a1a5rfzta8szu51n X-Rspamd-Queue-Id: 623B440020 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1665450079-105724 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: To get finer granularity for ratio calculations use part per 10000 instead of percentiles. This is especially important if we want to automatically convert byte values to ratios. Otherwise the values that are actually used can be quite different. This is also important for machines with more main memory (1% of 256GB is already 2.5GB). Signed-off-by: Stefan Roesch --- include/linux/backing-dev.h | 3 +++ mm/backing-dev.c | 6 +++--- mm/page-writeback.c | 15 +++++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 9c984ffc8a0a..f698befa76a0 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -102,6 +102,9 @@ static inline unsigned long wb_stat_error(void) #endif } +/* BDI ratio is expressed as part per 10000 for finer granularity. */ +#define BDI_RATIO_SCALE 100 + int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit); diff --git a/mm/backing-dev.c b/mm/backing-dev.c index f9aaa14ad98f..e64bc49561b1 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -178,7 +178,7 @@ static ssize_t min_ratio_store(struct device *dev, return ret; } -BDI_SHOW(min_ratio, bdi->min_ratio) +BDI_SHOW(min_ratio, bdi->min_ratio / BDI_RATIO_SCALE) static ssize_t max_ratio_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) @@ -197,7 +197,7 @@ static ssize_t max_ratio_store(struct device *dev, return ret; } -BDI_SHOW(max_ratio, bdi->max_ratio) +BDI_SHOW(max_ratio, bdi->max_ratio / BDI_RATIO_SCALE) static ssize_t stable_pages_required_show(struct device *dev, struct device_attribute *attr, @@ -811,7 +811,7 @@ int bdi_init(struct backing_dev_info *bdi) kref_init(&bdi->refcnt); bdi->min_ratio = 0; - bdi->max_ratio = 100; + bdi->max_ratio = 100 * BDI_RATIO_SCALE; bdi->max_prop_frac = FPROP_FRAC_BASE; INIT_LIST_HEAD(&bdi->bdi_list); INIT_LIST_HEAD(&bdi->wb_list); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index e22aae0ecacd..4d5383d4da45 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -197,7 +197,7 @@ static void wb_min_max_ratio(struct bdi_writeback *wb, min *= this_bw; min = div64_ul(min, tot_bw); } - if (max < 100) { + if (max < 100 * BDI_RATIO_SCALE) { max *= this_bw; max = div64_ul(max, tot_bw); } @@ -655,6 +655,8 @@ int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) unsigned int delta; int ret = 0; + min_ratio *= BDI_RATIO_SCALE; + spin_lock_bh(&bdi_lock); if (min_ratio > bdi->max_ratio) { ret = -EINVAL; @@ -665,7 +667,7 @@ int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) bdi->min_ratio = min_ratio; } else { delta = min_ratio - bdi->min_ratio; - if (bdi_min_ratio + delta < 100) { + if (bdi_min_ratio + delta < 100 * BDI_RATIO_SCALE) { bdi_min_ratio += delta; bdi->min_ratio = min_ratio; } else { @@ -684,6 +686,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) if (max_ratio > 100) return -EINVAL; + max_ratio *= BDI_RATIO_SCALE; spin_lock_bh(&bdi_lock); if (bdi->min_ratio > max_ratio) { @@ -776,15 +779,15 @@ static unsigned long __wb_calc_thresh(struct dirty_throttle_control *dtc) fprop_fraction_percpu(&dom->completions, dtc->wb_completions, &numerator, &denominator); - wb_thresh = (thresh * (100 - bdi_min_ratio)) / 100; + wb_thresh = (thresh * (100 * BDI_RATIO_SCALE - bdi_min_ratio)) / (100 * BDI_RATIO_SCALE); wb_thresh *= numerator; wb_thresh = div64_ul(wb_thresh, denominator); wb_min_max_ratio(dtc->wb, &wb_min_ratio, &wb_max_ratio); - wb_thresh += (thresh * wb_min_ratio) / 100; - if (wb_thresh > (thresh * wb_max_ratio) / 100) - wb_thresh = thresh * wb_max_ratio / 100; + wb_thresh += (thresh * wb_min_ratio) / (100 * BDI_RATIO_SCALE); + if (wb_thresh > (thresh * wb_max_ratio) / (100 * BDI_RATIO_SCALE)) + wb_thresh = thresh * wb_max_ratio / (100 * BDI_RATIO_SCALE); return wb_thresh; } From patchwork Tue Oct 11 01:00:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9385C4332F for ; Tue, 11 Oct 2022 01:01:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DDC98E0005; Mon, 10 Oct 2022 21:01:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 15743900006; Mon, 10 Oct 2022 21:01:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8B798E0005; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 743FD8E0003 for ; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4B1191C0A22 for ; Tue, 11 Oct 2022 01:01:23 +0000 (UTC) X-FDA: 80006865246.01.EA6A5ED Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf01.hostedemail.com (Postfix) with ESMTP id D259C40032 for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 0949134BDDD8; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 05/14] mm: add bdi_get_max_bytes() function Date: Mon, 10 Oct 2022 18:00:35 -0700 Message-Id: <20221011010044.851537-6-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450083; a=rsa-sha256; cv=none; b=DlVbRUZdr64G3u9hUwhDGj/dPMQ48WAulSgyB8uJRExydrcwAf2sGC3Pd2g6wI/FQA9m/c psCWZvKukA7sMCy/tTjQ3mrCYmRgExuvOmnApTsZaapc+SbkAjsr0aJDiy0/Mwc5LPwqYd twnKJVJgt1IHHAVPpDGGRySkIgXz22U= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=neutral (imf01.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450083; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eGM9X4lLfDxwFe0RwRhRngmlCprVdvr/l1lPDWnKz60=; b=nyk/9gVTtmnKguYXmDUYkeCRqy09fXxJo3qwcIEK8ZpuNIlhsXL0xkKAvdF4WlRSMCXWve hXHsKYstH18b/LesXDzIuUgd+QwTLL1UQcUJPnCjtC4EirkpEhnYvbRqXflRWTce7uAF84 e6PQRXVWmjCb5WfMxmBvF+Ky8H4w7lo= Authentication-Results: imf01.hostedemail.com; dkim=none; spf=neutral (imf01.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-Stat-Signature: 1ea9uc49au49mwmygsk7ype3ubmj5hdr X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D259C40032 X-Rspam-User: X-HE-Tag: 1665450082-170041 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This adds a function to return the specified value for max_bytes. It converts the stored max_ratio of the bdi to the corresponding bytes value. It introduces the bdi_get_bytes helper function to do the conversion. This is an approximation as it is based on the value that is returned by global_dirty_limits(), which can change. The helper function will also be used by the min_bytes bdi knob. Signed-off-by: Stefan Roesch --- include/linux/backing-dev.h | 1 + mm/page-writeback.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index f698befa76a0..94fedf66c915 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -105,6 +105,7 @@ static inline unsigned long wb_stat_error(void) /* BDI ratio is expressed as part per 10000 for finer granularity. */ #define BDI_RATIO_SCALE 100 +unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi); int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 4d5383d4da45..0b9dcf5afda2 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -650,6 +650,18 @@ void wb_domain_exit(struct wb_domain *dom) */ static unsigned int bdi_min_ratio; +static unsigned long long bdi_get_bytes(unsigned int ratio) +{ + unsigned long background_thresh; + unsigned long dirty_thresh; + unsigned long long bytes; + + global_dirty_limits(&background_thresh, &dirty_thresh); + bytes = (dirty_thresh * PAGE_SIZE * ratio) / BDI_RATIO_SCALE / 100; + + return bytes; +} + int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) { unsigned int delta; @@ -701,6 +713,12 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) } EXPORT_SYMBOL(bdi_set_max_ratio); +unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi) +{ + return bdi_get_bytes(bdi->max_ratio); +} +EXPORT_SYMBOL_GPL(bdi_get_max_bytes); + int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit) { if (strict_limit > 1) From patchwork Tue Oct 11 01:00:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56C82C433FE for ; Tue, 11 Oct 2022 01:01:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DE42900004; Mon, 10 Oct 2022 21:01:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 04106900003; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC765900004; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 98CFB900002 for ; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5EB45C0FFC for ; Tue, 11 Oct 2022 01:01:23 +0000 (UTC) X-FDA: 80006865246.01.6A2B6D6 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf27.hostedemail.com (Postfix) with ESMTP id D7BE84001A for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 0ED0134BDDDA; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 06/14] mm: split off __bdi_set_max_ratio() function Date: Mon, 10 Oct 2022 18:00:36 -0700 Message-Id: <20221011010044.851537-7-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450083; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LqUVGiHmiJ6DXSLgcbrND54x5kK2lO6fc/yi//3REBY=; b=49SB/mXGyakrtnFbD0yn79grhDphnqV3sZ3SnoMjaoCden6QoaJT4Bz13LB1u7EWQTJBZX J/CU0OOb/SYBy4asE5G82mtBVjhdPRaxf8ref4UlmXGbtXsdOhMQm0tOIyh4Y5gYRrFO5c 3dL4/uekXZiGbimEPuLuiar2745IIkk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=neutral (imf27.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450083; a=rsa-sha256; cv=none; b=vxNqjEP1Wa/9mQSLB0SASjYUkm3IAmcsY7cPN5s+3cB06cbpCJpYlchsk8l9PdKgxdzbtY eWVRGbFOc5fnZQl/y3+cBaOl15ymnVoUsinKTRoZ0PAYiyQHRaPBf77hIrPwkNjTjCqL0D QwnR35cyty4XXOugfm3mygC9cTBh5II= Authentication-Results: imf27.hostedemail.com; dkim=none; spf=neutral (imf27.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: tbxn7x937xyxqfpipiw4u3dz8n3tbsk1 X-Rspamd-Queue-Id: D7BE84001A X-HE-Tag: 1665450082-996552 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This splits off the __bdi_set_max_ratio() function from the bdi_set_max_ratio() function. The __bdi_set_max_ratio() function will also be called from the bdi_set_max_bytes() function, which will be introduced in the next patch. Signed-off-by: Stefan Roesch --- mm/page-writeback.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 0b9dcf5afda2..8b8936603783 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -692,14 +692,10 @@ int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) return ret; } -int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) +static int __bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) { int ret = 0; - if (max_ratio > 100) - return -EINVAL; - max_ratio *= BDI_RATIO_SCALE; - spin_lock_bh(&bdi_lock); if (bdi->min_ratio > max_ratio) { ret = -EINVAL; @@ -711,6 +707,14 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) return ret; } + +int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) +{ + if (max_ratio > 100) + return -EINVAL; + + return __bdi_set_max_ratio(bdi, max_ratio * BDI_RATIO_SCALE); +} EXPORT_SYMBOL(bdi_set_max_ratio); unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi) From patchwork Tue Oct 11 01:00:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B05C1C433FE for ; Tue, 11 Oct 2022 01:01:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3EC508E0002; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3756E6B0080; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 177CB8E0002; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 036BB8E0001 for ; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BFCD980FE6 for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) X-FDA: 80006865204.07.23A3EEB Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf05.hostedemail.com (Postfix) with ESMTP id 5AA34100025 for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 143E934BDDDC; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 07/14] mm: add bdi_set_max_bytes() function. Date: Mon, 10 Oct 2022 18:00:37 -0700 Message-Id: <20221011010044.851537-8-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450082; a=rsa-sha256; cv=none; b=snz2Cxfzmq2l0Gp9iydFJe1DQbG/qQtGHqGYoTK/cKHYTRtZUUOQIzlqt3Br/r5vptAE2W 0lwoIToQmzv0BXCjarIt/o2Ix0CO9rJXGcGmZovIGkIsqCZtMl+zeJTHkSPQ9AkKp6n5kY i36JjUGLvl/t61LesQJtS85xB1ncYmI= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf05.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450082; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yA3Fy5aq+RPK3mUVVAXlmIRHSh44Hb3uSGxFbumPhLE=; b=uZyRiWukEMWZsQhfXrjHZyFRz2s1otk+55TKHw5rdTILDqilr42RHnX+HLV5TK5MrDD1S3 bRvnA7F7BgP/JIT/tEKqgQVdpuhkr7XRV6jt6PIus36NW9Txmbyb4GaoSLyaniROYRVMKz FckgeUAUXrW6axqePbbZhSJnrZi6aos= Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf05.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io X-Stat-Signature: ycjofrwibcekgu6795uudkweazso31pp X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5AA34100025 X-Rspam-User: X-HE-Tag: 1665450082-200014 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This introduces the bdi_set_max_bytes() function. The max_bytes function does not store the max_bytes value. Instead it converts the max_bytes value into the corresponding ratio value. Signed-off-by: Stefan Roesch --- include/linux/backing-dev.h | 1 + mm/page-writeback.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 94fedf66c915..a10598f90d4d 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -108,6 +108,7 @@ static inline unsigned long wb_stat_error(void) unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi); int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); +int bdi_set_max_bytes(struct backing_dev_info *bdi, unsigned long long max_bytes); int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit); /* diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 8b8936603783..a6594ebdcbd8 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -650,6 +650,28 @@ void wb_domain_exit(struct wb_domain *dom) */ static unsigned int bdi_min_ratio; +static int bdi_check_pages_limit(unsigned long pages) +{ + unsigned long max_dirty_pages = global_dirtyable_memory(); + + if (pages > max_dirty_pages / 2) + return -EINVAL; + + return 0; +} + +static unsigned long bdi_ratio_from_pages(unsigned long long pages) +{ + unsigned long background_thresh; + unsigned long dirty_thresh; + unsigned long ratio; + + global_dirty_limits(&background_thresh, &dirty_thresh); + ratio = (pages * 100 * BDI_RATIO_SCALE) / dirty_thresh; + + return ratio; +} + static unsigned long long bdi_get_bytes(unsigned int ratio) { unsigned long background_thresh; @@ -723,6 +745,21 @@ unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi) } EXPORT_SYMBOL_GPL(bdi_get_max_bytes); +int bdi_set_max_bytes(struct backing_dev_info *bdi, unsigned long long max_bytes) +{ + int ret; + unsigned long pages = max_bytes >> PAGE_SHIFT; + unsigned long max_ratio; + + ret = bdi_check_pages_limit(pages); + if (ret) + return ret; + + max_ratio = bdi_ratio_from_pages(pages); + return __bdi_set_max_ratio(bdi, max_ratio); +} +EXPORT_SYMBOL_GPL(bdi_set_max_bytes); + int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit) { if (strict_limit > 1) From patchwork Tue Oct 11 01:00:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 743DCC4332F for ; Tue, 11 Oct 2022 01:01:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5782900007; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DD09900008; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 856FF900007; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6D347900005 for ; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2DFC51A0FEA for ; Tue, 11 Oct 2022 01:01:29 +0000 (UTC) X-FDA: 80006865498.15.92950CF Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf13.hostedemail.com (Postfix) with ESMTP id 6C8002002B for ; Tue, 11 Oct 2022 01:01:28 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 19A1534BDDDE; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 08/14] mm: Add new knob /sys/class/bdi//max_bytes Date: Mon, 10 Oct 2022 18:00:38 -0700 Message-Id: <20221011010044.851537-9-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=neutral (imf13.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450088; a=rsa-sha256; cv=none; b=eLLW/QNOIOXYkJOzPbxu77vOypon7xx3x6NH1/UaK4o5Au6jU3JEnpGvLAYEWjoIFaDyk/ Ry6llRfeVZYj1Gb5Blso1jxiZ3Y97GCFDC90IHQOQTOg67R3aq4kHyjoZwru0eBqYMPGUJ 7W3vhKiOaeLExQl6/+p2luxrGU1BWMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450088; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F4NPhnB88Tya0oth5y1oYsdLs0otd0rcqLckIwUpYxQ=; b=jNTd/snu7FTcCPCGgTlLO6gYzccTVQsng9IDzy/VwmkiAVoCDrcmCHV/2hYb7hq6k9NDWY YgbJscUqkrpAMI0zpDj+rcEI+w2g/jKfuiiaZaT884yL94ag1aX1NxlpFj7PSHi7ig65s7 Ggwy3xBc9w/UsujlUVCFyMcxrjLO2N8= X-Rspamd-Queue-Id: 6C8002002B X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=none; spf=neutral (imf13.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-Rspamd-Server: rspam10 X-Stat-Signature: xzrwa9c6et4sn8tqzfyuuzt9941cugz9 X-HE-Tag: 1665450088-949307 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This adds the new knob max_bytes to specify a dirty memory limit for the corresponding bdi. The specified bytes value is converted to a ratio. Signed-off-by: Stefan Roesch --- mm/backing-dev.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mm/backing-dev.c b/mm/backing-dev.c index e64bc49561b1..a3cad145b219 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -199,6 +199,34 @@ static ssize_t max_ratio_store(struct device *dev, } BDI_SHOW(max_ratio, bdi->max_ratio / BDI_RATIO_SCALE) +static ssize_t max_bytes_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct backing_dev_info *bdi = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%llu\n", bdi_get_max_bytes(bdi)); +} + +static ssize_t max_bytes_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct backing_dev_info *bdi = dev_get_drvdata(dev); + unsigned long long bytes; + ssize_t ret; + + ret = kstrtoull(buf, 10, &bytes); + if (ret < 0) + return ret; + + ret = bdi_set_max_bytes(bdi, bytes); + if (!ret) + ret = count; + + return ret; +} +DEVICE_ATTR_RW(max_bytes); + static ssize_t stable_pages_required_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -241,6 +269,7 @@ static struct attribute *bdi_dev_attrs[] = { &dev_attr_read_ahead_kb.attr, &dev_attr_min_ratio.attr, &dev_attr_max_ratio.attr, + &dev_attr_max_bytes.attr, &dev_attr_stable_pages_required.attr, &dev_attr_strict_limit.attr, NULL, From patchwork Tue Oct 11 01:00:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C07BBC433F5 for ; Tue, 11 Oct 2022 01:01:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B924E900002; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA040900003; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88BBE8E0005; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4F767900002 for ; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 19CDB1607CE for ; Tue, 11 Oct 2022 01:01:23 +0000 (UTC) X-FDA: 80006865246.27.3DE3704 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf18.hostedemail.com (Postfix) with ESMTP id 9E8981C0022 for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 1EFC534BDDE0; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 09/14] mm: document new /sys/class/bdi//max_bytes knob Date: Mon, 10 Oct 2022 18:00:39 -0700 Message-Id: <20221011010044.851537-10-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450082; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FG2YZJniK6WQyGMVTRehiSJED6hFD5pcUkGd65cLNIA=; b=gm2KJ7XvuJhFXz+Fc3MT4baSydKGLWao1uiJN/oAcjKGRR/71jSdH1lMwIZtIikanV31Ct /f9e2k3Bj1CIOdVYqDddQ2FijrnscaSLNuEFCiQyT1WhZJpxciWRnJk++Q9+wvNJZ9wnds 0UyPfMyeg5bWd7+7qCvS154Gk5ralf4= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf18.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450082; a=rsa-sha256; cv=none; b=PoMGH9JXaUJEHlOoBfBFuxJS3ccckzMBVMNTlfcWLHSVp0w1Q+bfdzC/EyXOWb6rfrOUeb BCv2tszoywGpbw3Y5mfgCqNfVa2YrbbKYHfCthG72lR4OVhB1G4UquRo119LE56fJVPV9X Knras37mida4mI7eIEfK3VXhUdQikZE= Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf18.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io X-Stat-Signature: 1r3r6qk45r7fkkd3azm1bbye3f3ofcas X-Rspamd-Queue-Id: 9E8981C0022 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1665450082-199252 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This documents the new /sys/class/bdi//max_bytes knob. Signed-off-by: Stefan Roesch --- Documentation/ABI/testing/sysfs-class-bdi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-bdi b/Documentation/ABI/testing/sysfs-class-bdi index 68b5d4018c2f..580f723de049 100644 --- a/Documentation/ABI/testing/sysfs-class-bdi +++ b/Documentation/ABI/testing/sysfs-class-bdi @@ -56,6 +56,20 @@ Description: be trusted to play fair. (read-write) + +What: /sys/class/bdi//max_bytes +Date: October 2022 +Contact: Stefan Roesch +Description: + Allows limiting a particular device to use not more than the + given 'max_bytes' of the write-back cache. This is useful in + situations where we want to avoid one device taking all or + most of the write-back cache. For example in case of an NFS + mount that is prone to get stuck, a FUSE mount which cannot be + trusted to play fair, or a nbd device. + + (read-write) + What: /sys/class/bdi//strict_limit Date: October 2022 Contact: Stefan Roesch From patchwork Tue Oct 11 01:00:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3EC7C4332F for ; Tue, 11 Oct 2022 01:01:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 443EE900008; Mon, 10 Oct 2022 21:01:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EB22900005; Mon, 10 Oct 2022 21:01:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F126E90000A; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BB636900005 for ; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 65976A0D6E for ; Tue, 11 Oct 2022 01:01:29 +0000 (UTC) X-FDA: 80006865498.07.912029C Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf25.hostedemail.com (Postfix) with ESMTP id B8492A0021 for ; Tue, 11 Oct 2022 01:01:28 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 2466A34BDDE2; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 10/14] mm: add bdi_get_min_bytes() function. Date: Mon, 10 Oct 2022 18:00:40 -0700 Message-Id: <20221011010044.851537-11-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450088; a=rsa-sha256; cv=none; b=60CuAPnvNrZl5cwZqZhEh1xo2LD3gEiPM2DZKmERyhsWpm0tSqRbEe4E2+IuMs7A82Y02i gB8tgLms6vO5uoT1PuNDZ7lbEMTXq5X1/vD+i5vkE0kvqMkz67tggv0yCTXbZ2EaJKiYU5 DTRfi2py5qx4Rr/nm0L2sXt/iYfg+oA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf25.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450088; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pLxfc6prB2JeUA+HemeduNZ2qP6Byk3PNBbrBtVfzSY=; b=ZrM+UWwWBMBLD7g8NBPStu8HBvLAgAeiXPg2hvaOGOKxmQFEVECfVsMsuEZ0aidZSAHRxL dxncXXiPujkyTnlUfiXhtYcmL/RT1ZNTBrsH/17JPEWxxD3DZizugdd1UtXBHVKFpkcTrR fAzF3S4QL+tWnXR6eaarqch1Y7T4laA= X-Stat-Signature: 7w65rni4bsudg75tdu76j5gk4qawwbdw X-Rspamd-Queue-Id: B8492A0021 Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf25.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1665450088-611893 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This adds a function to return the specified value for min_bytes. It converts the stored min_ratio of the bdi to the corresponding bytes value. This is an approximation as it is based on the value that is returned by global_dirty_limits(), which can change. The returned value can be different than the value when the min_bytes value was set. Signed-off-by: Stefan Roesch --- include/linux/backing-dev.h | 1 + mm/page-writeback.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index a10598f90d4d..cdb131b57fcb 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -105,6 +105,7 @@ static inline unsigned long wb_stat_error(void) /* BDI ratio is expressed as part per 10000 for finer granularity. */ #define BDI_RATIO_SCALE 100 +unsigned long long bdi_get_min_bytes(struct backing_dev_info *bdi); unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi); int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index a6594ebdcbd8..a37a25994ad8 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -739,6 +739,12 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) } EXPORT_SYMBOL(bdi_set_max_ratio); +unsigned long long bdi_get_min_bytes(struct backing_dev_info *bdi) +{ + return bdi_get_bytes(bdi->min_ratio); +} +EXPORT_SYMBOL_GPL(bdi_get_min_bytes); + unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi) { return bdi_get_bytes(bdi->max_ratio); From patchwork Tue Oct 11 01:00:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0424DC433FE for ; Tue, 11 Oct 2022 01:01:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F126D900009; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E70E7900008; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1DC9900009; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9A3C2900005 for ; Mon, 10 Oct 2022 21:01:29 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5591DA5069 for ; Tue, 11 Oct 2022 01:01:29 +0000 (UTC) X-FDA: 80006865498.14.266A00E Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf06.hostedemail.com (Postfix) with ESMTP id BB14A180016 for ; Tue, 11 Oct 2022 01:01:28 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 29E2634BDDE4; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 11/14] mm: split off __bdi_set_min_ratio() function Date: Mon, 10 Oct 2022 18:00:41 -0700 Message-Id: <20221011010044.851537-12-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450088; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=teDNe1Ua7LbxZMqlEBzF6LNgDM/LSr7KGIqwPnX0YBc=; b=xkV7yuFrCsua3L1uDlP/X2h+8mFejw7WNS9k6NDf+a9J5BFwVpc+7oL1uGPPcNkT6G0HqV 11Vgbvv//QLPinRLTtBsso9kTSATb8BGtFSHmMdtQaXHlxl7FrkzfFLxtjs7sIIYhgTHB4 EiSzWfh0hyUNqmDx1torLJYct5uDaDM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf06.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450088; a=rsa-sha256; cv=none; b=zt5iX61VakGTL0Xg+sWIWILDSsBJOtwNJIjwrs/0jHf1chMx+6yvYyfyn26hjF6poATYNm AV11Q6OQMOGVQBz4BjUwjxrAZ4/Y3G/GQA2nN5MClUTiTgYboo7t8vgvmVgtBiLNDg0kos cbm7hm8W3k6AMUfCOA+wzbOaOcq1cqc= X-Stat-Signature: ubwrwas3ha96nhbpbpxijztma3cdrkcw X-Rspamd-Server: rspam09 X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf06.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io X-Rspamd-Queue-Id: BB14A180016 X-HE-Tag: 1665450088-27200 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This splits off the __bdi_set_min_ratio() function from the bdi_set_min_ratio() function. The __bdi_set_min_ratio() function will also be called from the bdi_set_min_bytes() function, which will be introduced in the next patch. Signed-off-by: Stefan Roesch --- mm/page-writeback.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index a37a25994ad8..7733dcf96d7e 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -684,7 +684,7 @@ static unsigned long long bdi_get_bytes(unsigned int ratio) return bytes; } -int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) +static int __bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) { unsigned int delta; int ret = 0; @@ -730,6 +730,11 @@ static int __bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ra return ret; } +int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) +{ + return __bdi_set_min_ratio(bdi, min_ratio * BDI_RATIO_SCALE); +} + int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) { if (max_ratio > 100) From patchwork Tue Oct 11 01:00:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CD86C433F5 for ; Tue, 11 Oct 2022 01:01:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64AFF900003; Mon, 10 Oct 2022 21:01:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B14F8E0003; Mon, 10 Oct 2022 21:01:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D641E900005; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id AB9B28E0003 for ; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7C30580FDD for ; Tue, 11 Oct 2022 01:01:23 +0000 (UTC) X-FDA: 80006865246.24.35EE43A Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf26.hostedemail.com (Postfix) with ESMTP id DAA35140028 for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 2F60834BDDE6; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 12/14] mm: add bdi_set_min_bytes() function Date: Mon, 10 Oct 2022 18:00:42 -0700 Message-Id: <20221011010044.851537-13-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450083; a=rsa-sha256; cv=none; b=Y+1uOWgGEfHDAby+ZvtZHrSj8EPBmvSPlN/8J0aDTE/iZmb3OWAUsCxiCmvHqn7gsRtMpV ZUZaImopQkYGl31uZLVyJqhRIojBdx7XYUu1vJWUnwUlThVPhjEeNtJNsmyeL7ggRY/Pgc 1sqH2KBQEg5848He8dsbwLtDoJrxTSo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf26.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450083; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zo+OBQ8i2EL7+t7yoiZZm9Lkj4Rjn0L2mEcpA/nvNpI=; b=sZfKJHMBsS9jBHImnFYZwBt2dz8Ikkrw7GVjPF24010UUjxcD16KrA1ezdGmPdOFLAAN0y Mqd/pC8i05xZrbbZJRyUT9i1QLA9Fizg2GPF1iNHu4qA122XfcEvAQHmOscQH3JtXUOhT3 8PMMZv7Zox9y3eliFQHa3sF5RLbx4+k= X-Stat-Signature: xu1iag89w7je3ufkoubf85kr13objifu X-Rspamd-Queue-Id: DAA35140028 Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf26.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1665450082-671927 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This introduces the bdi_set_min_bytes() function. The min_bytes function does not store the min_bytes value. Instead it converts the min_bytes value into the corresponding ratio value. Signed-off-by: Stefan Roesch --- include/linux/backing-dev.h | 1 + mm/page-writeback.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index cdb131b57fcb..8db058f331bc 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -109,6 +109,7 @@ unsigned long long bdi_get_min_bytes(struct backing_dev_info *bdi); unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi); int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); +int bdi_set_min_bytes(struct backing_dev_info *bdi, unsigned long long min_bytes); int bdi_set_max_bytes(struct backing_dev_info *bdi, unsigned long long max_bytes); int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 7733dcf96d7e..04c4a142098b 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -750,6 +750,21 @@ unsigned long long bdi_get_min_bytes(struct backing_dev_info *bdi) } EXPORT_SYMBOL_GPL(bdi_get_min_bytes); +int bdi_set_min_bytes(struct backing_dev_info *bdi, unsigned long long min_bytes) +{ + int ret; + unsigned long pages = min_bytes >> PAGE_SHIFT; + unsigned long min_ratio; + + ret = bdi_check_pages_limit(pages); + if (ret) + return ret; + + min_ratio = bdi_ratio_from_pages(pages); + return __bdi_set_min_ratio(bdi, min_ratio); +} +EXPORT_SYMBOL_GPL(bdi_set_min_bytes); + unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi) { return bdi_get_bytes(bdi->max_ratio); From patchwork Tue Oct 11 01:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58172C433FE for ; Tue, 11 Oct 2022 01:01:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC099900006; Mon, 10 Oct 2022 21:01:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E21DD900005; Mon, 10 Oct 2022 21:01:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB45C900006; Mon, 10 Oct 2022 21:01:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8B374900005 for ; Mon, 10 Oct 2022 21:01:28 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 603DA80FE6 for ; Tue, 11 Oct 2022 01:01:28 +0000 (UTC) X-FDA: 80006865456.19.D59D9E8 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf07.hostedemail.com (Postfix) with ESMTP id 04D3540003 for ; Tue, 11 Oct 2022 01:01:27 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 34F0734BDDE8; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 13/14] mm: add new /sys/class/bdi//min_bytes knob Date: Mon, 10 Oct 2022 18:00:43 -0700 Message-Id: <20221011010044.851537-14-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450088; a=rsa-sha256; cv=none; b=a9qEVYQTj4ZH7zrHURy1u1nZb4rGPJqlcg7aB55K+VQxbAlSNm/jEPxdQs4rWtJIr1Iz8u LdguQ0eUuryNQX2Ol3bco1TGzD2n4M+5eDbO/oLUKYTo1P86+mXUlik6BZqCvGVtpiiYWv iZVryC9TvqkfjTQBCIjARjyaoMON3mU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=neutral (imf07.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450088; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uXtfaVBDz7DiWQRPfJu6UbCeaRS4NDba7VNBm2xnqEM=; b=2yrt3lDLR168JVGnwAikSVtZA1O9d+DjGSH+P7i2sP0rzdGiFzPBJo0JobycmpsbaC+TPy 3ANMK6x4K3cYcC96czChcmBzAZD+KfuD8eR8f2nl88XzTxi3/hi77TQE5LbgJ3KnHlFFKc 4PMt/4+8yShIex1raBOTZvj1b8ut4p0= Authentication-Results: imf07.hostedemail.com; dkim=none; spf=neutral (imf07.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-Stat-Signature: boy1j4t158fk9ob9srzkq95upqx9qphb X-Rspamd-Queue-Id: 04D3540003 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1665450087-328199 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: bdi has two existing knobs to limit the amount of dirty memory: min_ratio and max_ratio. However the granularity of the knobs is limited and often it is more convenient to specify limits in terms of bytes. This change adds the min_bytes knob. It does not store the min_bytes value, instead it converts the max_bytes value to a ratio. The value is therefore more an approximation than an absolute value. It also maintains the sum over all the bdi min_ratio values stored in the variable bdi_min_ratio. Signed-off-by: Stefan Roesch --- mm/backing-dev.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mm/backing-dev.c b/mm/backing-dev.c index a3cad145b219..9962a2d92fe3 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -199,6 +199,34 @@ static ssize_t max_ratio_store(struct device *dev, } BDI_SHOW(max_ratio, bdi->max_ratio / BDI_RATIO_SCALE) +static ssize_t min_bytes_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct backing_dev_info *bdi = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%llu\n", bdi_get_min_bytes(bdi)); +} + +static ssize_t min_bytes_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct backing_dev_info *bdi = dev_get_drvdata(dev); + unsigned long long bytes; + ssize_t ret; + + ret = kstrtoull(buf, 10, &bytes); + if (ret < 0) + return ret; + + ret = bdi_set_min_bytes(bdi, bytes); + if (!ret) + ret = count; + + return ret; +} +DEVICE_ATTR_RW(min_bytes); + static ssize_t max_bytes_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -269,6 +297,7 @@ static struct attribute *bdi_dev_attrs[] = { &dev_attr_read_ahead_kb.attr, &dev_attr_min_ratio.attr, &dev_attr_max_ratio.attr, + &dev_attr_min_bytes.attr, &dev_attr_max_bytes.attr, &dev_attr_stable_pages_required.attr, &dev_attr_strict_limit.attr, From patchwork Tue Oct 11 01:00:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64C19C433F5 for ; Tue, 11 Oct 2022 01:01:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB52A80008; Mon, 10 Oct 2022 21:01:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B63A780007; Mon, 10 Oct 2022 21:01:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A037E80008; Mon, 10 Oct 2022 21:01:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8BE5280007 for ; Mon, 10 Oct 2022 21:01:35 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5C7CFC1005 for ; Tue, 11 Oct 2022 01:01:35 +0000 (UTC) X-FDA: 80006865750.26.5C87051 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf05.hostedemail.com (Postfix) with ESMTP id F19D6100025 for ; Tue, 11 Oct 2022 01:01:34 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 3A7F134BDDEA; Mon, 10 Oct 2022 18:01:06 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com Subject: [RFC PATCH v1 14/14] mm: document new /sys/class/bdi//min_bytes knob Date: Mon, 10 Oct 2022 18:00:44 -0700 Message-Id: <20221011010044.851537-15-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665450095; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3EUi6jPj2vZbV6ealsadFNrxvkct4936SBuSwS/JJic=; b=4KWi8ihFg5Ql32eEaZaNcyTJ9hWD55t2k3rxRHlbaBOUppPmSFs9hYb09hYJeokqz+yh8b +cYvEWqvVR2/S6WokYgnmC6l0yRLD9OYZIORft4VLgY7fzSKDeCnsBOiRBRd1jOwYMcfjp C0OGx/9FrKtw3PL8ZDjfqizqJN/4QtE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=neutral (imf05.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665450095; a=rsa-sha256; cv=none; b=Lu7G4+FbK5oX/AvTN4+b133LN4pjPxC7BJd0kgeafBnuVUMnfMEUIWt72gmSWainb+YWtR ZU+gr73I+kgWznZfIxLHs7VUmam6Gs39QMzGkyCu2Dmk531xqqbzm6+EzyiqIgld0qswit kMnWOtzP30DZXjnSrBXrXhi1wb5xgxU= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: F19D6100025 X-Stat-Signature: qmjhmb1weu7y5m98bdh7r89dkmpzuqam Authentication-Results: imf05.hostedemail.com; dkim=none; spf=neutral (imf05.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-HE-Tag: 1665450094-920695 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This documents the new /sys/class/bdi//min_bytes knob. Signed-off-by: Stefan Roesch --- Documentation/ABI/testing/sysfs-class-bdi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-bdi b/Documentation/ABI/testing/sysfs-class-bdi index 580f723de049..bec996e29565 100644 --- a/Documentation/ABI/testing/sysfs-class-bdi +++ b/Documentation/ABI/testing/sysfs-class-bdi @@ -57,6 +57,21 @@ Description: (read-write) +What: /sys/class/bdi//min_bytes +Date: October 2022 +Contact: Stefan Roesch +Description: + Under normal circumstances each device is given a part of the + total write-back cache that relates to its current average + writeout speed in relation to the other devices. + + The 'min_bytes' parameter allows assigning a minimum + percentage of the write-back cache to a particular device + expressed in bytes. + For example, this is useful for providing a minimum QoS. + + (read-write) + What: /sys/class/bdi//max_bytes Date: October 2022 Contact: Stefan Roesch