From patchwork Thu Nov 12 21:26:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11901641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58B101391 for ; Thu, 12 Nov 2020 21:26:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F01C222241 for ; Thu, 12 Nov 2020 21:26:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="NXmVbUS7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F01C222241 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DA37E6B005C; Thu, 12 Nov 2020 16:26:53 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CF2256B006C; Thu, 12 Nov 2020 16:26:53 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A38CE6B005C; Thu, 12 Nov 2020 16:26:53 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id 6D9E66B005D for ; Thu, 12 Nov 2020 16:26:53 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0CF1E180AD801 for ; Thu, 12 Nov 2020 21:26:53 +0000 (UTC) X-FDA: 77477051106.04.hate34_5013d0027309 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id C89248008873 for ; Thu, 12 Nov 2020 21:26:52 +0000 (UTC) X-Spam-Summary: 1,0,0,81ea7c5f9d3244c9,d41d8cd98f00b204,willy@infradead.org,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1542:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2895:2898:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:5007:6119:6261:6653:7875:10004:11026:11658:11914:12043:12050:12296:12297:12438:12555:12895:13894:14181:14394:14721:21080:21324:21451:21627:21990:30034:30054:30055:30064:30070:30090:30091,0,RBL:90.155.50.34:@infradead.org:.lbl8.mailshell.net-62.8.15.100 64.201.201.201;04yrioqckm78jhtp8poas6bigmgycocrmybhfpswr9hids499hgwja9abhaphg3.cujy6ujfu4jaxxi6tknyb5rq9t4gu4u8s7wygmwicp489tp3f1t7rhiijzd7k33.s-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:780,LUA_SUMMARY:none X-HE-Tag: hate34_5013d0027309 X-Filterd-Recvd-Size: 3888 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 21:26:50 +0000 (UTC) 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=hHTBK4BYPzK5sxPr2WzuBNxW83FIC+F2fBOyFQf+0ws=; b=NXmVbUS7kRm/236rRSQxvtyc2U ZZHRvCkKVgQjP/gVzR/xk/YlN5IHiVxBG0u+WMV5uEX2gjlgQ73lS/hgOm1Ha4Rs/6O+uRjHC+CLq fmShrL0C1mKrjpFXW77suorHT+7Kkl9bUcF9BCkdjqUr/ycSP8+qRzJzauuWslNUTX8GZy5VLNPTz piHbKC5WBneycVJN40+v62WUOGcRQpiMw1Hm4QK/mFyUHiIer9DD6yFQ4bhzkYe7eopd7TtwLC/Xl bzf26tY7NklsxMfzn85KbmdBIIqRMLBdnc7hgs3MojXF5HgJuESEIXUEA/hBj/XGmXroZuuIB8EFO Joy1oLtQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdK79-0007G4-NF; Thu, 12 Nov 2020 21:26:43 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , akpm@linux-foundation.org, hughd@google.com, hch@lst.de, hannes@cmpxchg.org, yang.shi@linux.alibaba.com, dchinner@redhat.com, linux-kernel@vger.kernel.org, Jan Kara , William Kucharski Subject: [PATCH v4 01/16] mm: Make pagecache tagged lookups return only head pages Date: Thu, 12 Nov 2020 21:26:26 +0000 Message-Id: <20201112212641.27837-2-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201112212641.27837-1-willy@infradead.org> References: <20201112212641.27837-1-willy@infradead.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Christoph Hellwig --- mm/filemap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 249cf489f5df..bb6f2ae5a68c 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,9 @@ 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. @index is updated to the index immediately after the last + * page we return, ready for the next iteration. * * Return: the number of pages which were found. */ @@ -2109,9 +2110,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;