From patchwork Mon Oct 24 19:05:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13017991 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 EB7F0ECAAA1 for ; Mon, 24 Oct 2022 19:06:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D6CD6940011; Mon, 24 Oct 2022 15:06:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D1D5594000C; Mon, 24 Oct 2022 15:06:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9447940011; Mon, 24 Oct 2022 15:06:37 -0400 (EDT) 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 A7A3B94000C for ; Mon, 24 Oct 2022 15:06:37 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2B6E21C398A for ; Mon, 24 Oct 2022 19:06:37 +0000 (UTC) X-FDA: 80056774434.21.2BF0942 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf06.hostedemail.com (Postfix) with ESMTP id 95E0018000A for ; Mon, 24 Oct 2022 19:06:36 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 81FC93ED591C; Mon, 24 Oct 2022 12:06:12 -0700 (PDT) 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, willy@infradead.org, hch@infradead.org Subject: [RFC PATCH v3 10/14] mm: add bdi_get_min_bytes() function. Date: Mon, 24 Oct 2022 12:05:59 -0700 Message-Id: <20221024190603.3987969-11-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221024190603.3987969-1-shr@devkernel.io> References: <20221024190603.3987969-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666638396; a=rsa-sha256; cv=none; b=TNz6g1jOXhOIWZgQyPqhiFnJYCh0xs6i00cqxaepuQ/G7WGfktPWBp6VhForjegpRFzaPD Iusnb+OU+mMxnBQI9xZuhoE3jXgF/vEPj5QIxJCo2PD28GWb/AMjk0kFv1P2Xeg2/wntXZ NUGf4wu/rj0xov3JGd3bnyCUEvL08qs= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=neutral (imf06.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=1666638396; 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=zUGrJmpr+WL12/APdEMCSVUI9VYkfwrAflxorHJthMg=; b=iMPosptOnIW3LSAS7chvfgCNYq0IFqenyFdarJME1Na/uW9IwMAFrCeNLx9Dwam9m/YrB6 0Lf6h9dvAY6kIDPnnW3t9SRBl9VU1iuw2HEiylDNeCl1ZMndZwb0IFhv0hcSgBQuTo32JO MUHBwifDhmBTv6WCmLFHnJARvc8JPI8= X-Rspamd-Queue-Id: 95E0018000A X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=none; spf=neutral (imf06.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-Rspamd-Server: rspam04 X-Stat-Signature: zzr3ddbjsf954e3wzbhmx7o85up555ox X-HE-Tag: 1666638396-156737 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 | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 5eb1ae3410b2..621329f25bbe 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 1000 for finer granularity. */ #define BDI_RATIO_SCALE 10 +unsigned long long bdi_get_min_bytes(struct backing_dev_info *bdi); unsigned long long 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 21d7c1880ea8..69fc2866e625 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -740,6 +740,12 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) } EXPORT_SYMBOL(bdi_set_max_ratio); +unsigned long long bdi_get_min_bytes(struct backing_dev_info *bdi) +{ + return bdi_get_bytes(bdi->min_ratio); +} +EXPORT_SYMBOL_GPL(bdi_get_min_bytes); + unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi) { return bdi_get_bytes(bdi->max_ratio);