From patchwork Fri Sep 15 18:38:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13387474 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 1F035EED61A for ; Fri, 15 Sep 2023 18:39:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 583DF6B03C6; Fri, 15 Sep 2023 14:39:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E7986B03C7; Fri, 15 Sep 2023 14:39:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E8786B03C8; Fri, 15 Sep 2023 14:39:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1351B6B03C6 for ; Fri, 15 Sep 2023 14:39:33 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DE03016022F for ; Fri, 15 Sep 2023 18:39:32 +0000 (UTC) X-FDA: 81239694984.03.3C21D25 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf16.hostedemail.com (Postfix) with ESMTP id 3ACEF180011 for ; Fri, 15 Sep 2023 18:39:30 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=RPZ4s8vK; dmarc=none; spf=pass (imf16.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694803171; 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:dkim-signature; bh=q4TCivlOldBFT8Z2wAp0Ng9dYEvWAP3/q/X1t2+ztPU=; b=G0sfgx16bwnomKQKODvQHUXszlN7A9Zi0ktgi4UTFJvveUu1y5npxvPAldQGEVbRzU05RP U5BgRB3qUJ/NkbYzSgeE3opV0xYnQh5Qvl0Moq5WXtprn6nGWZCwTAaLQ/hYkQuopHtm3k 7V5x4MACsLU/9k5HzNoLEmOV+xbayUE= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=RPZ4s8vK; dmarc=none; spf=pass (imf16.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694803171; a=rsa-sha256; cv=none; b=tQJqNO6M3bXZaKdzSB+s5B2dp9HGTfX6WKwjcwgkPc7i1jcEhIp5M9gihSDTVWci2LGuah gPKNDinSX0dw/9F/Nnq3B7feeu89nKnPyKjyJQJHe2sos/FZAtl526juRexdMJ/5GtJlyK gzxMhzxxOt3uKubkrhwyv7zEixK5JQc= Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4RnNJc0jbrz9skM; Fri, 15 Sep 2023 20:39:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q4TCivlOldBFT8Z2wAp0Ng9dYEvWAP3/q/X1t2+ztPU=; b=RPZ4s8vKpZT/VgCDTXGfaQnmmINoQDMFRzcMXIHnpBidw45xmmsecAsEx/bgHiklwedk3E jvirvcLSdjCEKPoKBTXOwRhiD+JcHZqICcAdTub1hkWK1sl+vUO2I19nRcEBG44QWyKZYa Q9/F/S6P5EG0+NyIw3zXCVgYKM66eP7A+kreb4oIgyIl6glr1J0ELYt+/5YuNN/+WZ++4c gG0NIEJsO5zNGaAPcdC78ZH6UEtst+I+MpVN/IUixQdfIfKRDwezhqBQuACrnDm0eW/GMh 9oc+cvHQHKIr4P0CNSWVZ8eOFxkQ1CJn2IaTfklFETTMeeOw5hpiP+jYbhuJCg== From: Pankaj Raghav To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: p.raghav@samsung.com, david@fromorbit.com, da.gomez@samsung.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, willy@infradead.org, djwong@kernel.org, linux-mm@kvack.org, chandan.babu@oracle.com, mcgrof@kernel.org, gost.dev@samsung.com Subject: [RFC 13/23] readahead: set file_ra_state->ra_pages to be at least mapping_min_order Date: Fri, 15 Sep 2023 20:38:38 +0200 Message-Id: <20230915183848.1018717-14-kernel@pankajraghav.com> In-Reply-To: <20230915183848.1018717-1-kernel@pankajraghav.com> References: <20230915183848.1018717-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3ACEF180011 X-Stat-Signature: opf7azf38qoy1u4tzbe5ts186c4c416i X-Rspam-User: X-HE-Tag: 1694803170-303403 X-HE-Meta: U2FsdGVkX1+rACvFKl4XGTLFjldpV19MRhX6fb5FR+SmexipYXcPLEn6PHwpfoOwV6lRnV2hNcsXhWu1hZ2TPzmGv7b+3BiMgQE21yXhMKkNBdys5JKvxVrOVm9PSbUFgl0N4bLvCyoswZx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tG2QViP176btgxERKw4ZcMs5O/yUze7ODwpKNbEmH9/qXYHkH816/zKZJJKpMiyLquJAA0MVfAizCiDhx+KfBxnOhd+ruZgxCTuDrGqHpbTGHvBhbT7/ave4UzALPMLx4XEkcyD5Cxv7CrBqckArXh8g/jEOuLJdQNf66Ud1OEKibgYn X-Bogosity: Ham, tests=bogofilter, spamicity=0.000021, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Luis Chamberlain Set the file_ra_state->ra_pages in file_ra_state_init() to be at least mapping_min_order of pages if the bdi->ra_pages is less than that. Signed-off-by: Luis Chamberlain --- mm/readahead.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index ef3b23a41973..5c4e7ee64dc1 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -138,7 +138,13 @@ void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping) { + unsigned int order = mapping_min_folio_order(mapping); + unsigned int min_nrpages = 1U << order; + unsigned int max_pages = inode_to_bdi(mapping->host)->io_pages; + ra->ra_pages = inode_to_bdi(mapping->host)->ra_pages; + if (ra->ra_pages < min_nrpages && min_nrpages < max_pages) + ra->ra_pages = min_nrpages; ra->prev_pos = -1; } EXPORT_SYMBOL_GPL(file_ra_state_init);