From patchwork Mon Oct 17 18:13:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13009239 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 3FFDFC43219 for ; Mon, 17 Oct 2022 18:16:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B70E8E000A; Mon, 17 Oct 2022 14:16:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE3368E0007; Mon, 17 Oct 2022 14:16:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFEB78E000A; Mon, 17 Oct 2022 14:16:46 -0400 (EDT) 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 AE5FB8E0007 for ; Mon, 17 Oct 2022 14:16:46 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 73659160D0F for ; Mon, 17 Oct 2022 18:16:46 +0000 (UTC) X-FDA: 80031247212.18.2F2A517 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 E833C100030 for ; Mon, 17 Oct 2022 18:16:45 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 44E9F39C99C6; Mon, 17 Oct 2022 11:13:56 -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 v2 10/14] mm: add bdi_get_min_bytes() function. Date: Mon, 17 Oct 2022 11:13:33 -0700 Message-Id: <20221017181337.3884657-11-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221017181337.3884657-1-shr@devkernel.io> References: <20221017181337.3884657-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=1666030606; 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=5HNtT2D4okHKWExVxt+QjyvzzXQe2cjqnwjG+4w8RjE=; b=bzr1WynfPa8TRJJd3+699Y6cBhvwiGfoOQ+Wl7SCXUxBV9mt9rVBmCmbU5nWfYCd0c6ove qFRr1A4ohZECFFVCHuAqbS0vJrhvWJ5gly0B+HU6Eydco4OhiiX9mSxWYFztZXR/GCXSHJ 5tNY2KQzudx1U11IWYaBLawY8sWYMrQ= 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666030606; a=rsa-sha256; cv=none; b=Ft925oazODJ2erOKjsQvCV8ciFwJBf1F7NXKop86kzb+WtGSbKJiqxJVA0KdZrxHJ9aruF hGkLh2qI4zDYLCiUvPTh3cXGSqozQtJGRlrmLjYXocMTqsog0jDAfsm0sePGReuecZRUT0 7onujugwg3bTEgrCk5MvF/G0qfGr/xg= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E833C100030 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-Stat-Signature: bnjucnur1i4mkmjbuez9x5j6tokzqkni X-HE-Tag: 1666030605-357918 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 a6594ebdcbd8..a37a25994ad8 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -739,6 +739,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);