Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp115901pxv; Thu, 15 Jul 2021 00:08:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNTYVe8RAMXtvfkyRzat7p2RB7b8+qTUeMSzMSwsSeXW97PfpMmHwTXevlBVD2sfisgXO4 X-Received: by 2002:a5d:91cc:: with SMTP id k12mr2046626ior.103.1626332909674; Thu, 15 Jul 2021 00:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626332909; cv=none; d=google.com; s=arc-20160816; b=y419f17Ib6k7l7UFVYgm1e0TfkdrqNiJFnKMciBFXXg9B6Im9J7/jbPG/aaBkujTL5 RKIWXMD+Sfz5Z5cSXfSU206IVR1Kwt3LA6d3tCpOmHuBfMnrmt4g3KPzaK54B4QuWHdM vYNAYuCLtxs/7DxVgOOdNVeCeGwo/As7Z/uXuRaqA0TEcB0OVTRfDeJkJ8ER2A1vhzlD l+8WpC/OLu62FWh8eSyp3Zc2JthlC+Zt26tfmiWsoPfmBAFV1RxTI+Lm37ziQyqo560B 1vsXDvbqwlUUTL5YT4IwpRL1rtjfdAC3XOjYHB8/uuJJ6R5RKJ2eBPvqifX3Hmhe7MNi 9uoA== 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=YqRnP/8a/779PEXECZaJ/RwhwSMj3E4PlE13UIsVZRY=; b=m2bcyCLaUBxmv9t11932u7QGmpmg2PFN7T4S/Ow0xVGz+NC+r/q39c3O/7ZwQiP7OB JufLw3qzW3Ggwy+vmroB1cpFg1cChVLfTfnnn/RhLsJV+zt82sXoS+XAiMSuO7C4qdiv 6EjDh+7A3S9FAMItjR01k7GTVCuzBJ4vspPQOpte/kzeQ9v1DNvy54ZlwUCS9MTFtFUv v4Pn0RNfSWL6xu/O4XFhH+Q8dA/9PcktOMACg94S2EkX3cIVCRlJYm55svnd0uYq21Vl o4fifzZUW6+FTIoU/ihma/VyFGXhdmwuTH59T3/zN4n9iPz/b4bXH6NEDUfMBIFY+mUs k3ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DCrOOoW0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q185si6460548iof.55.2021.07.15.00.08.17; Thu, 15 Jul 2021 00:08:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DCrOOoW0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239126AbhGOFMJ (ORCPT + 99 others); Thu, 15 Jul 2021 01:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233239AbhGOFMJ (ORCPT ); Thu, 15 Jul 2021 01:12:09 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D604C06175F; Wed, 14 Jul 2021 22:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=YqRnP/8a/779PEXECZaJ/RwhwSMj3E4PlE13UIsVZRY=; b=DCrOOoW08pAgZsmPiZpMkbts8P kgrCJi35u5FsXVXQauh0DHyp0lN1fxW0PAF52MVLeXfiux3cFFf01ksA+5BRcUwodT23tDcfA9eK8 OBP3+y6QJ7HpE3vdigyHC3Xa2z7/jdhBaqD/m1QSf++2B2TH9BKVpBBwL7E1yHMUlTiEbH4+Hyn+t T35XIkkul1kql/e7o2CRrw+Yu9ja75HGkXFSLNvD/mLeDZYeGsyWLYYkquA/gebxhcZpW/TqmfrJD n8pwbiSIvtkIOUfOisIiMKAgdjskcSXHuvZV2eEfJBgBMT9YBxc0m6biY0CZQfWbo4JdGlax39L70 HGm1Rd8w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3tbP-00301t-O5; Thu, 15 Jul 2021 05:08:16 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v14 112/138] mm/filemap: Convert filemap_get_read_batch to use folios Date: Thu, 15 Jul 2021 04:36:38 +0100 Message-Id: <20210715033704.692967-113-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The page cache only stores folios, never tail pages. Saves 29 bytes due to removing calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index c4190c0a6d86..04501bf50448 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2272,32 +2272,31 @@ static void filemap_get_read_batch(struct address_space *mapping, pgoff_t index, pgoff_t max, struct pagevec *pvec) { XA_STATE(xas, &mapping->i_pages, index); - struct page *head; + struct folio *folio; rcu_read_lock(); - for (head = xas_load(&xas); head; head = xas_next(&xas)) { - if (xas_retry(&xas, head)) + for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) { + if (xas_retry(&xas, folio)) continue; - if (xas.xa_index > max || xa_is_value(head)) + if (xas.xa_index > max || xa_is_value(folio)) break; - if (!page_cache_get_speculative(head)) + if (!folio_try_get_rcu(folio)) goto retry; - /* Has the page moved or been split? */ - if (unlikely(head != xas_reload(&xas))) + if (unlikely(folio != xas_reload(&xas))) goto put_page; - if (!pagevec_add(pvec, head)) + if (!pagevec_add(pvec, &folio->page)) break; - if (!PageUptodate(head)) + if (!folio_test_uptodate(folio)) break; - if (PageReadahead(head)) + if (folio_test_readahead(folio)) break; - xas.xa_index = head->index + thp_nr_pages(head) - 1; + xas.xa_index = folio->index + folio_nr_pages(folio) - 1; xas.xa_offset = (xas.xa_index >> xas.xa_shift) & XA_CHUNK_MASK; continue; put_page: - put_page(head); + folio_put(folio); retry: xas_reset(&xas); } -- 2.30.2