From patchwork Sat Nov 19 00:52:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13049511 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 6E6FDC4332F for ; Sat, 19 Nov 2022 01:57:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 048C76B0074; Fri, 18 Nov 2022 20:57:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F120A8E0002; Fri, 18 Nov 2022 20:57:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB2B06B0078; Fri, 18 Nov 2022 20:57:43 -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 CA4D26B0074 for ; Fri, 18 Nov 2022 20:57:43 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9F129AAB2A for ; Sat, 19 Nov 2022 01:57:43 +0000 (UTC) X-FDA: 80148530406.07.A8FDC55 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf02.hostedemail.com (Postfix) with ESMTP id 348FB80006 for ; Sat, 19 Nov 2022 01:57:42 +0000 (UTC) Received: by dev0134.prn3.facebook.com (Postfix, from userid 425415) id 742F119380DA; 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 10/20] mm: add bdi_get_min_bytes() function. Date: Fri, 18 Nov 2022 16:52:05 -0800 Message-Id: <20221119005215.3052436-11-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=1668823063; a=rsa-sha256; cv=none; b=YAmMnBLDUI/uKCCVN55UAxfq0ievNPI/18FBzcQUTDRI5UqCFBFYyMyThjzisfxl72hL/o GzXyw1/Ik+hKdNkC0YNyN1qLWZ96B2EQ2HqMDfWTosC+H1T9Dy2KzR2z6Iatn0IIgPMaHJ 5Ls3uA4qeVozoxx4bOzKRsqDamxxJ7o= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf02.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=1668823063; 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=nxtD0N2K1jYnFvRCEbMSRC9TXcgcDivRP5MqisE+u/Q=; b=x8mabs6LpYeMh9bPYRU3CW8Fm6rLV7jFFWH7ofhpuXHCRcYe4nvrI3vM2HbxU98N0/y5Ip 2N0uwUr8lyqww0NP+COM1apxqG04hCxpE0BylQw1dmWa5+kNZCXUgI+lGgk5AfJFgI50xg 03D2G5HekwfXiElEadRtsN4fRxJjXu8= X-Stat-Signature: 9bcz9drpmb63ufq197ruyeih7d4zqhhi X-Rspamd-Queue-Id: 348FB80006 Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=none; spf=neutral (imf02.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: rspam04 X-Rspam-User: X-HE-Tag: 1668823062-243822 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 | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index ea6c993433d5..8e04567727e6 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 1000000 for finer granularity. */ #define BDI_RATIO_SCALE 10000 +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); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 20ae9adeb22f..c47824464f4c 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -740,6 +740,11 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) } EXPORT_SYMBOL(bdi_set_max_ratio); +u64 bdi_get_min_bytes(struct backing_dev_info *bdi) +{ + return bdi_get_bytes(bdi->min_ratio); +} + u64 bdi_get_max_bytes(struct backing_dev_info *bdi) { return bdi_get_bytes(bdi->max_ratio);