From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18534C388F9 for ; Mon, 26 Oct 2020 04:41:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD17620878 for ; Mon, 26 Oct 2020 04:41:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="p47NmDV4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422281AbgJZElp (ORCPT ); Mon, 26 Oct 2020 00:41:45 -0400 Received: from casper.infradead.org ([90.155.50.34]:60106 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422279AbgJZElp (ORCPT ); Mon, 26 Oct 2020 00:41:45 -0400 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=S4uj6+LHbvxU3x1hyEQHv26ToiNAm0/3JPZsqUbH6YY=; b=p47NmDV4nDqyPquS0ChnyJEk42 OnWEUFsDTQ6ib7FbZtMxGRjnaQuuU02tA7CzkpNg6TxoIooBAGNqbPsZQb/z8UQWKhA2xJidAyZKp rif+IzLiDaht+LIyINpZaNbDUESpC1R5tvJnoU9frbWn7RiXFxk0qAZjlrm6cEJNasAeqWg0YIZts Sc7t0PsVthpztR+SAl3JAtpK5r1sZUA2sCK5O8Rt0rcfieHWWP0l5aLntEp5syE7w7JhuB/JwlGP/ 1/UmaG/cBKE5fxuNO0rvXUuRmTUDU0vwblPmjHEd+NH0iAmOy5bHVN5GkmtuPGs02aOvoPYEbEQiB c/ljcpuQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kWtta-0006Zj-Fu; Mon, 26 Oct 2020 04:14:10 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Andrew Morton , Hugh Dickins , Johannes Weiner , Yang Shi , Dave Chinner , linux-kernel@vger.kernel.org, Jan Kara , William Kucharski Subject: [PATCH v3 01/12] mm: Make pagecache tagged lookups return only head pages Date: Mon, 26 Oct 2020 04:13:57 +0000 Message-Id: <20201026041408.25230-2-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201026041408.25230-1-willy@infradead.org> References: <20201026041408.25230-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Pagecache tags are used for dirty page writeback. Since dirtiness is tracked on a per-THP basis, we only want to return the head page rather than each subpage of a tagged page. All the filesystems which use huge pages today are in-memory, so there are no tagged huge pages today. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Jan Kara Reviewed-by: William Kucharski --- mm/filemap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index d5e7c2029d16..edde5dc0d28f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2066,7 +2066,7 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index, EXPORT_SYMBOL(find_get_pages_contig); /** - * find_get_pages_range_tag - find and return pages in given range matching @tag + * find_get_pages_range_tag - Find and return head pages matching @tag. * @mapping: the address_space to search * @index: the starting page index * @end: The final page index (inclusive) @@ -2074,8 +2074,8 @@ EXPORT_SYMBOL(find_get_pages_contig); * @nr_pages: the maximum number of pages * @pages: where the resulting pages are placed * - * Like find_get_pages, except we only return pages which are tagged with - * @tag. We update @index to index the next page for the traversal. + * Like find_get_pages(), except we only return head pages which are tagged + * with @tag. We update @index to index the next page for the traversal. * * Return: the number of pages which were found. */ @@ -2109,9 +2109,9 @@ unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, if (unlikely(page != xas_reload(&xas))) goto put_page; - pages[ret] = find_subpage(page, xas.xa_index); + pages[ret] = page; if (++ret == nr_pages) { - *index = xas.xa_index + 1; + *index = page->index + thp_nr_pages(page); goto out; } continue; -- 2.28.0