From patchwork Sat Nov 19 00:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13049452 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 D4F95C4332F for ; Sat, 19 Nov 2022 01:21:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C44B56B0073; Fri, 18 Nov 2022 20:21:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA8296B0075; Fri, 18 Nov 2022 20:21:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C45F6B0074; Fri, 18 Nov 2022 20:21:38 -0500 (EST) 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 73DE26B0072 for ; Fri, 18 Nov 2022 20:21:38 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4A304A081F for ; Sat, 19 Nov 2022 01:21:38 +0000 (UTC) X-FDA: 80148439476.01.774FBE8 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 E15D8100002 for ; Sat, 19 Nov 2022 01:21:37 +0000 (UTC) Received: by dev0134.prn3.facebook.com (Postfix, from userid 425415) id 6272019380D2; 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 06/20] mm: split off __bdi_set_max_ratio() function Date: Fri, 18 Nov 2022 16:52:01 -0800 Message-Id: <20221119005215.3052436-7-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=1668820898; a=rsa-sha256; cv=none; b=Yi4JycFawOsxnMO4RgxgFqQBr9FaOzP7bUlxxa4XmR9EsYtb/PEu4wFmDEtJwkKTx5KaSQ 8K9FtW/GTfDMdH5ccR0QZrAoyDCgvD2HuZNUxxHpeE7QGDPxy3b98ZNAgeeAxB2/o9xcZT fqXRV8nsVvAovpJBkU0Q6Utyj7AwHNE= 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668820898; 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=VT73Scl9XxTxD5AA2/Eu27dKxenA/AlC3Wpwkh1bmqY=; b=OnsFMtOrA9ay4yPWn2pNxDL6CFflcV66Jf1JF35DrQ1fnZKMss4ZdLHthrj+OlxwP586fU GeRzGfItEpQ+7B7lZxGBMdmWwRwX6FBHtgGnoKtW80b6R8DUszNiNQrCGnwa00DnMMvP1O szn1cgpu08yHwsVNiXFOpFLPay1ZMAM= X-Stat-Signature: 8pja7ftnwas4qq8pinq9jqw7ke836sy8 X-Rspamd-Queue-Id: E15D8100002 X-Rspamd-Server: rspam01 X-Rspam-User: 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: 1668820897-146032 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 __bdi_set_max_ratio() from bdi_set_max_ratio(). __bdi_set_max_ratio() will also be called from bdi_set_max_bytes(), 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 719404e0d03d..e74ef596dc27 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); u64 bdi_get_max_bytes(struct backing_dev_info *bdi)