Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4834364rdb; Fri, 15 Sep 2023 13:53:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIg+cICCO6wJtlXRgVLKoq5DSSnLixDlPAAxPgghSt2eqi7V9GGR6mKW0/lrsmjO4Bfme0 X-Received: by 2002:a05:6a00:2eaa:b0:68f:b5cb:ced0 with SMTP id fd42-20020a056a002eaa00b0068fb5cbced0mr3146402pfb.34.1694811235250; Fri, 15 Sep 2023 13:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694811235; cv=none; d=google.com; s=arc-20160816; b=jvkYmLxBqF88PsH4yRdZHWMFvLBz5sIUtotYG59RSShRrNV4YDYZhXgoIWf7l1pOYu 8Iz8u1eDPCMu3YQImxlr3VI9MrWdKAm2tIw6tL9hmqWRYj8jGZ6W9xH3CtW3D4/f/56K 456vstPtNa7RkEdHP6bYtnoVa7Q2ahuDMWNRRo94mBOSeVkRcgRCFWK6nRtdIzPrjWCx iFJLjj7gDch3GZKWU6pAMr+448nLZEe5x6yutNW1pV1cMZ9ToX7GFjS2ST1q1BZxtFSj r7BsiKFWtXvAmAXAxtzoqqjll4OAzib31cSAkbe7SgI9F2HWPKj29aEmtGP82DqthDE2 eKNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q4TCivlOldBFT8Z2wAp0Ng9dYEvWAP3/q/X1t2+ztPU=; fh=kl+S4GAUWD1kOeoqBopscteh2mu3DZslcHc01dOJ6TI=; b=YegOGC99h4pJApN0un/OSQ3sVi1NZNiD+huZZmc2sbg9YZFfxeM1ZHs+gw5AhxArj5 48+QdtFFR+QBFfeFCDFL0i6U8T3/HDntDQ87BPGGvYOjBaRMhHSzvW3nRtSsa6h5Q7l1 gGGXZcqzYBH8ha1xKVu5Bzug2XZvWEr1P0jSo8ZFlpHxpU5cqdDkuDnQ4i6k4Cc3+SrG g+RXKRWNn2WrraP5Q3RTPnhrE0kYIHnz7ZRd6yYCryfvNyZw1TlE0it2IuyxabfKBwXH PyMwuWmTcpO/eydG3V2WYd+WrpcH3ed2hd06C+DkUz9jo9Eo5eLlklHgwoLRh832I5J2 IvSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=RPZ4s8vK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id cn15-20020a056a00340f00b0068fce6a86acsi3830159pfb.121.2023.09.15.13.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 13:53:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=RPZ4s8vK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 63C5E807C756; Fri, 15 Sep 2023 11:41:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236625AbjIOSk6 (ORCPT + 99 others); Fri, 15 Sep 2023 14:40:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236832AbjIOSkm (ORCPT ); Fri, 15 Sep 2023 14:40:42 -0400 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [IPv6:2001:67c:2050:0:465::103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDBD035AA; Fri, 15 Sep 2023 11:39:54 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4RnNJc0jbrz9skM X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:41:29 -0700 (PDT) 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); -- 2.40.1