From patchwork Sat Nov 19 00:52:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13049516 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 CE5FCC4332F for ; Sat, 19 Nov 2022 02:09:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F0386B0074; Fri, 18 Nov 2022 21:09:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DD916B0078; Fri, 18 Nov 2022 21:09:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3219A8E0001; Fri, 18 Nov 2022 21:09:45 -0500 (EST) 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 1F0EF6B0074 for ; Fri, 18 Nov 2022 21:09:45 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D150A40AF1 for ; Sat, 19 Nov 2022 02:09:44 +0000 (UTC) X-FDA: 80148560688.16.158A332 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 70EB040008 for ; Sat, 19 Nov 2022 02:09:44 +0000 (UTC) Received: by dev0134.prn3.facebook.com (Postfix, from userid 425415) id 8D4A619380E8; Fri, 18 Nov 2022 16:52:18 -0800 (PST) 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, akpm@linux-foundation.org Subject: [RFC PATCH v4 16/20] mm: add /sys/class/bdi//max_ratio_fine knob Date: Fri, 18 Nov 2022 16:52:11 -0800 Message-Id: <20221119005215.3052436-17-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221119005215.3052436-1-shr@devkernel.io> References: <20221119005215.3052436-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668823784; a=rsa-sha256; cv=none; b=pTAMzWSCLkvS6c8Tc6SYiCMnvBvasU6625MR7K1lezgEJ8vpey+SiVhOWaJd9RbFmw4aTp yvh0jCMtkrO0LIJSieQZ5HUNRZ2jhoKtAXGBFDglLQBpVC76qScD217GvUanLeX7kymU8T PWj0eKyF94VMfNHHjGjMc0jM55sdjQA= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668823784; 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=WzJI9fdAKySthuAC8ejnhXYwfTG0H+erXO63GWB12m0=; b=OjTHaL0PrcygYOVPI5bs8Fibq+Ys+KglKxLSRvtDuPfBRlkpJifa6KQV8lhdbI6VGiLbsT cYc+O/+VxKX3kRCng59cXE25HXZKScoJsxdd6h2jhDk8/XLzs5qlGg/Utbuhc9PyfmW+QZ vNnMoyYvPMLj0/GPxZyz5Cyz6sZjy8w= X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 70EB040008 Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=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 X-Stat-Signature: fhdyy3twux9zoq9z6p1jkkrz6u7fhjwr X-HE-Tag: 1668823784-182367 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 max_ratio_fine knob. The knob specifies the values not based on 1 of 100, but instead 1 per million. Signed-off-by: Stefan Roesch --- mm/backing-dev.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 3fab79061ade..94c2382367cf 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -199,6 +199,25 @@ static ssize_t max_ratio_store(struct device *dev, } BDI_SHOW(max_ratio, bdi->max_ratio / BDI_RATIO_SCALE) +static ssize_t max_ratio_fine_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 ratio; + ssize_t ret; + + ret = kstrtouint(buf, 10, &ratio); + if (ret < 0) + return ret; + + ret = bdi_set_max_ratio_no_scale(bdi, ratio); + if (!ret) + ret = count; + + return ret; +} +BDI_SHOW(max_ratio_fine, bdi->max_ratio) + static ssize_t min_bytes_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -297,6 +316,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_ratio_fine.attr, &dev_attr_min_bytes.attr, &dev_attr_max_bytes.attr, &dev_attr_stable_pages_required.attr,