From patchwork Sat Nov 19 00:52:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13049517 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 A9CFEC4321E for ; Sat, 19 Nov 2022 02:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1778F6B0078; Fri, 18 Nov 2022 21:09:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 089376B007B; 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 E45838E0001; Fri, 18 Nov 2022 21:09:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D59EC6B0078 for ; Fri, 18 Nov 2022 21:09:45 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B0EBDAAE2E for ; Sat, 19 Nov 2022 02:09:45 +0000 (UTC) X-FDA: 80148560730.08.08A177D Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf20.hostedemail.com (Postfix) with ESMTP id 3464F1C0006 for ; Sat, 19 Nov 2022 02:09:44 +0000 (UTC) Received: by dev0134.prn3.facebook.com (Postfix, from userid 425415) id 95A1E19380ED; 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 18/20] mm: add bdi_set_min_ratio_no_scale() function Date: Fri, 18 Nov 2022 16:52:13 -0800 Message-Id: <20221119005215.3052436-19-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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668823785; 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=kWwF9efk52Saq5MY+cBPHsGvoMLbDiQx8CkAmxnBcS0=; b=0dVzr+ERNrx3SQKFecasEijBNIlyxLwqRO7gRva0Gd/fp1okSe9WYPek79RpkjCi/1ljeY GxgOuGwuTB6mu21z9QTVhHeMw47M/qD7Vq0gQ2m/a92+6ra4zK6cx/ksmnHMVE0UKBpGHr z6uImKEIPOIFe3rw5wH4V490jXNFS2k= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf20.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=1668823785; a=rsa-sha256; cv=none; b=x837heBOPxJPvsk0krFtWVK/XY2T9Fmrz1U3t2DtSY5s48qleM7wcFUIzw3pMKuurduDXE Giaeald/q6Kzt7KhLBtbdQq6RAQOpGAcXG923aTZZfCfHyzpDcAGzydv5FGoT1NqdUIyqM IhCu5eUpHz8POl0p6YkYPxpMgUrK2Xk= X-Rspam-User: X-Stat-Signature: 8aaboewe7y6gk1xs3iff7tqf447q1pao X-Rspamd-Queue-Id: 3464F1C0006 Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf20.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io X-Rspamd-Server: rspam07 X-HE-Tag: 1668823784-475249 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 bdi_set_min_ratio_no_scale(). It uses the max granularity for the ratio. This function by the new sysfs knob min_ratio_fine. Signed-off-by: Stefan Roesch --- include/linux/backing-dev.h | 1 + mm/page-writeback.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index d9acbb22ff25..fbad4fcd408e 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -109,6 +109,7 @@ u64 bdi_get_min_bytes(struct backing_dev_info *bdi); u64 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_ratio_no_scale(struct backing_dev_info *bdi, unsigned int min_ratio); int bdi_set_max_ratio_no_scale(struct backing_dev_info *bdi, unsigned int max_ratio); int bdi_set_min_bytes(struct backing_dev_info *bdi, u64 min_bytes); int bdi_set_max_bytes(struct backing_dev_info *bdi, u64 max_bytes); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index f44ade72966c..ad608ef2a243 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -690,6 +690,8 @@ static int __bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ra unsigned int delta; int ret = 0; + if (min_ratio > 100 * BDI_RATIO_SCALE) + return -EINVAL; min_ratio *= BDI_RATIO_SCALE; spin_lock_bh(&bdi_lock); @@ -734,6 +736,11 @@ static int __bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ra return ret; } +int bdi_set_min_ratio_no_scale(struct backing_dev_info *bdi, unsigned int min_ratio) +{ + return __bdi_set_min_ratio(bdi, min_ratio); +} + int bdi_set_max_ratio_no_scale(struct backing_dev_info *bdi, unsigned int max_ratio) { return __bdi_set_max_ratio(bdi, max_ratio);