From patchwork Sat Nov 19 00:52:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13049527 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 3BB02C4332F for ; Sat, 19 Nov 2022 02:21:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 982C96B0072; Fri, 18 Nov 2022 21:21:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9333C6B0073; Fri, 18 Nov 2022 21:21:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 821BD6B0074; Fri, 18 Nov 2022 21:21:47 -0500 (EST) 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 72A196B0072 for ; Fri, 18 Nov 2022 21:21:47 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 45BEA1A0808 for ; Sat, 19 Nov 2022 02:21:47 +0000 (UTC) X-FDA: 80148591054.20.47FEBC8 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf11.hostedemail.com (Postfix) with ESMTP id CE00540004 for ; Sat, 19 Nov 2022 02:21:46 +0000 (UTC) Received: by dev0134.prn3.facebook.com (Postfix, from userid 425415) id 99BAD19380EF; 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 19/20] mm: add /sys/class/bdi//min_ratio_fine knob Date: Fri, 18 Nov 2022 16:52:14 -0800 Message-Id: <20221119005215.3052436-20-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=1668824507; a=rsa-sha256; cv=none; b=Q8L7mnTsDGKGzMJEdTCDXQx+/dCTBlqbTUbSz96yPBGI++zXcFWAh+praoCY+xHZNyYIb1 Sv5hPyZ1GQVpy2XFDyuAFL/rdZQ3n7/Lsj6Jk7SAVfLRchX6XVbit/NT2tQE/ZjLZPLANz CAT2r7K8uUCAWDCp+9mY7m+vUrs02DY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf11.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=1668824507; 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=nD5ACcCeKXwK39Bja+H6lmd1c0kYUAc8hPfCYjF6Qgw=; b=wV0P3RMnQE83wjXNfnLCndGulraOl2qR56cl3OhweWXeaSjd9WYHgQnv+YrkdQ57HcZBgs XbnEgwyMonGCb3dCen2iH+47ZaBL1v50elPTDQal6gp+QEKtHadKBpmZso7/GtzDEm7+29 Iu786eysBizwl2iu3LQ5yu7fJFElhLM= X-Stat-Signature: g7c1ytkw8dby6skmhqboji69y6a4t53u X-Rspamd-Queue-Id: CE00540004 Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf11.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: rspam10 X-HE-Tag: 1668824506-562723 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 min_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 94c2382367cf..a53b9360b72e 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -180,6 +180,25 @@ static ssize_t min_ratio_store(struct device *dev, } BDI_SHOW(min_ratio, bdi->min_ratio / BDI_RATIO_SCALE) +static ssize_t min_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_min_ratio_no_scale(bdi, ratio); + if (!ret) + ret = count; + + return ret; +} +BDI_SHOW(min_ratio_fine, bdi->min_ratio) + static ssize_t max_ratio_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -315,6 +334,7 @@ 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_min_ratio_fine.attr, &dev_attr_max_ratio.attr, &dev_attr_max_ratio_fine.attr, &dev_attr_min_bytes.attr,