Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4934508rdb; Fri, 15 Sep 2023 18:02:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjB9zoYI8Q08oCc+40qAUuk1Rj3JsbWs+evqnHDMV0CaAY7X+lj9OD8ICrTCeK0wQg2yph X-Received: by 2002:a17:902:e744:b0:1c0:bf60:ba82 with SMTP id p4-20020a170902e74400b001c0bf60ba82mr3412670plf.5.1694826126389; Fri, 15 Sep 2023 18:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694826126; cv=none; d=google.com; s=arc-20160816; b=MswMCN5mRYkukytseXYkgys5tpq7kM1a8pN0a6zPHRQBIIVRvKRXsWh3XLDUZrS4y2 xXEAyu6r9tGmw47/GVWCqYU1px/PuKVtgWfQ7Iap3kn5diKj3TMJuh23nTew26X7YU/A ameVLB6BUA+2bMJM8r5KZ1EOyuzbItkaIIeCO1DgjEUUItvxA/jBnySBruYxsxMQCc1r Nr0aSJEAZit2bEQIkmQ7SIfP1mCw8z9jOUp5Fk8GGyE8Zm7bJ625e2jY11yH+kNXjlkM LtwyBJDZkjmGk+hYYE0q2AuF5eOtYdI/00317jKIX0S1dgKR2RwgKhvuUZhoWDDL15+q Y1Bg== 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=iOYqPSu+oVCOd89+RaAtiuAgqa7oaErhDOx7o0+X38E=; fh=kl+S4GAUWD1kOeoqBopscteh2mu3DZslcHc01dOJ6TI=; b=Z4KYHqpMeaqbsWu+YhEfPctCpeZsp9WoKS+HwrLWyqzRM6eCQL2Aafzn467mMQNous qHDljRuac9hwgpjMmRu7YRyWnLGK4WcMIUUk1E72bn2zvkfeSMjPhfqdWuNgSoLoB6Ez nCtipbYwzy2EAynQBTjkk03xxYV1w2r2iZJ6kJR3IeTuNMGE02RKHvEpxY2PFEMTv46N D3cMrho6XCdc391Qgx6GuIqgfTonNzSat2lZjH/vr1RozJ6PkzqVnEA2/nHmuhReotSF aRk92vlcfjlbHe3hyHji7t4V/stw2hAGQJ3pl8DFOzgalAE2YC7k0Y3myZlroWNNcl7C WeHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=flQNjUny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i17-20020a170902e49100b001c3a2e70278si4155751ple.437.2023.09.15.18.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:02:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=flQNjUny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 0B8C380A164F; Fri, 15 Sep 2023 11:41:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236601AbjIOSla (ORCPT + 99 others); Fri, 15 Sep 2023 14:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236829AbjIOSlM (ORCPT ); Fri, 15 Sep 2023 14:41:12 -0400 X-Greylist: delayed 70 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 15 Sep 2023 11:40:08 PDT Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E965E2719; Fri, 15 Sep 2023 11:40:08 -0700 (PDT) Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (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-202.mailbox.org (Postfix) with ESMTPS id 4RnNJn36Rwz9sbW; Fri, 15 Sep 2023 20:39:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803177; 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=iOYqPSu+oVCOd89+RaAtiuAgqa7oaErhDOx7o0+X38E=; b=flQNjUnyU25W7ZGoZco4mDtUzalhwJdm/Bip/rbg2I7G+1AE2WK86hUhNm9re8XYQltTbW Q1UDpffAJOx5HxpxhTPWaT+BSJpH86ccESygaGzrHRoAl5a6HWVXDBTEyaXOGrB36BUlFJ UJidHKi+CEgQGEa5bx3L4Zay4lNQkQrS+WRXtZcwIJXqP8EAA8xyZ7WjuimYFHT6oowESq Fo+uCzgXisnLoV5PFAOd1As8LnA3i8F2vc9tZxxok3KJTKvhHophEy6lJ04F5KBoY0aNft 1ZXo8HQVFMQ3CahHpKra2M7qoAf4kdCWBLeQrGgqKkHiklzRWbTaCAql3Y6Xfw== 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 16/23] readahead: add folio with at least mapping_min_order in page_cache_ra_order Date: Fri, 15 Sep 2023 20:38:41 +0200 Message-Id: <20230915183848.1018717-17-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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:41:58 -0700 (PDT) From: Luis Chamberlain Set the folio order to at least mapping_min_order before calling ra_alloc_folio(). Signed-off-by: Luis Chamberlain --- mm/readahead.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mm/readahead.c b/mm/readahead.c index 838dd9ca8dad..fb5ff180c39e 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -506,6 +506,7 @@ void page_cache_ra_order(struct readahead_control *ractl, { struct address_space *mapping = ractl->mapping; pgoff_t index = readahead_index(ractl); + unsigned int min_order = mapping_min_folio_order(mapping); pgoff_t limit = (i_size_read(mapping->host) - 1) >> PAGE_SHIFT; pgoff_t mark = index + ra->size - ra->async_size; int err = 0; @@ -535,10 +536,16 @@ void page_cache_ra_order(struct readahead_control *ractl, order = 0; } /* Don't allocate pages past EOF */ - while (index + (1UL << order) - 1 > limit) { + while (order > min_order && index + (1UL << order) - 1 > limit) { if (--order == 1) order = 0; } + + if (order < min_order) + order = min_order; + + VM_BUG_ON(index & ((1UL << order) - 1)); + err = ra_alloc_folio(ractl, index, mark, order, gfp); if (err) break; -- 2.40.1